I’m trying to build a loop querying all fields of an option page, so that i don’t have to put ‘option’ on all get_field(). Right now it is a loop querying fields of page_id=6. How can i change it to query all fields of a built options page ?
<?php $q = new WP_Query( 'page_id=6' );
if ( $q->have_posts()) : $q->the_post();?>
<?php endif; wp_reset_postdata() ?>
Thank you !
You cannot. Options pages are not stored in any way that associates them with anything that is queryable as a “page” or “post”.
You can use the
'post_id' option when adding an options page to associate the fields of the options page with a specific post ID, but in order to do what you want you’d probably need to have some type of custom post type or something to use, although you might be able to get away with using any existing post ID as long as that post is never deleted.