GET request results in 404
-
Hi, guys.
I am having a serious problem here and sincerely hope you can help me. I am trying to use GET requests to handle some WP query filtering of ACF posts (custom post type ‘services’).
So I set up the following in my functions.php:add_action('pre_get_posts', 'my_pre_get_posts', 10, 1); function my_pre_get_posts( $query ) { if( isset($query->query_vars['post_type']) && $query->query_vars['post_type'] == 'services' ) { if( isset($_GET['services']) ) { $query->set('meta_key', 'services-field'); $query->set('meta_value', $_GET['services']); } } return $query; } add_action('pre_get_posts', 'my_pre_get_posts');
However, running a <url>/services/?services=Something ends up showing my 404 page.
Any idea what I might be doing wrong?
Using WP4.9.5 with X Theme 6.0.4 and ACF Pro.
Thanks a lot!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘GET request results in 404’ is closed to new replies.