Home › Forums › ACF PRO › Retrieving option throws massive error › Reply To: Retrieving option throws massive error
Yes it is (located in a pre_get_posts filter), as shown below.
function profile_search_form( $query ) {
$results_per_page = get_option( 'posts_per_page' );
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$exclude = sd_exclude_dummy();
if ( ! is_admin() && $query->is_main_query() && isset( $_GET['ssd8'] ) && 1 == $_GET['ssd8'] ) {
// output on search page
if ( $query->is_search ) {
$no_errors = false;
include( get_template_directory() . '/inc/search/profile-search-query.php' );
if ( true == $no_errors ) {
$query->set( 's', false );
$query->set( 'post_type', PostTypes::PROFILE );
$query->set( 'post__not_in', $exclude );
$query->set( 'posts_per_page', $results_per_page );
if ( isset( $_GET[ 'sp' ] ) && 'tour' == $_GET[ 'sp' ] ) {
add_filter( 'posts_where', 'sd_tour_cities_searches' );
}
$query->set( 'meta_query', $meta_query );
$query->set( 'tax_query', $tax_query );
}
}
}
}
add_action( 'pre_get_posts', 'profile_search_form' );
It exists in a few queries, since I need to hide this dummy post for regular visitors. It only needs to show in archives sometimes, when I test things.
How can I easily solve this ?
Would defining it as a constant be a simple solution ?
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
Accordions are a great way to group related information while allowing users to interactively show and hide content. In this video, Damon Cook goes in-depth on how to create an accessible accordion block using ACF PRO’s Repeater field.https://t.co/RXT0g25akN
— Advanced Custom Fields (@wp_acf) March 2, 2023
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.