Need solution for 404s produced by $query->set

This topic contains 2 replies, has 2 voices, and was last updated by  Paolo 7 years, 7 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #395714

    a led
    Free User
    Post count: 5

    I posted this question in “GeoDirectory Core Plugin support” and then read the support policy and decided that I should post here:

    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’) );
    }
    });

    #395758

    a led
    Free User
    Post count: 5

    I think I have this problem solved now. I searched the geodirectory plugin for the necessary code addition.

    #395781

    Paolo
    Site Admin
    Post count: 31211

    Hi A Led,

    I’m sorry for the late reply, but glad you could find the solution.

    Let us know if we can help you with anything else.

    Thanks

Viewing 3 posts - 1 through 3 (of 3 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