Including gd_place in pre_get_posts $query->set

This topic contains 1 reply, has 1 voice, and was last updated by  a led 7 years, 7 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #395657

    a led
    Free User
    Post count: 5

    My function for querying custom post types that are created independently of Geodirectory causes the Geodirectory listings to be 404. And including the Geodirectory gd_place post type in the $query->set (below) does not solve the problem. Do you have a solution?

    add_action(‘pre_get_posts’, function( $query ) {

    //Exit if not Main Query
    if (!$query->is_main_query()){
    return;
    }

    //If Querying Posts & Pages, Update Query to include Custom Post Types
    if (!empty($query->query[‘name’]) ) {
    $query->set(‘post_type’, array(‘post’, ‘page’, ‘locations’, ‘services’) );
    }

    });

    #395716

    a led
    Free User
    Post count: 5

    After reading the Support Policy, I put this question (above) in General Discussion: https://wpgeodirectory.com/support/topic/need-solution-for-404s-produced-by-query-set/

Viewing 2 posts - 1 through 2 (of 2 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount