Support

Account

Home Forums ACF PRO Issue with Custom Field Filter

Solving

Issue with Custom Field Filter

  • I’m following this guide, but as soon as I add the parameters to the URL I get a 404 error.

    http://www.advancedcustomfields.com/resources/creating-wp-archive-custom-field-filter/

    If I then change the parameter name to something else, the page loads, but obviously then the code doesn’t work!

    Any help would be appreciated.

  • Usually when you get a 404 error it’s because one of the query parameters is a reserved name in WP. For example ‘post_id’ and ‘name’ are reserverd. If you use these you’ll get a 404 error.

    What are the parameter names you’re trying to use?

  • I’ve tried bedrooms, rooms, min-rooms and minimum-rooms. All lead to a 404 error whilst that query is in the script. If I change the script to be looking for rooms, but enter ‘min-rooms’ into the URL, I no longer get the 404 error, so there doesn’t appear to be anything other than the script itself causing the issue.

  • I’ve tried setting up a simple test like this. I’ve created fields named bedrooms, city and state. It appears to be working.

    2 thinks, this code should look something like this:

    
    $GLOBALS['my_query_filters'] = array( 
      'field_565712fdeba5c'	=> 'city', 
      'field_565713a9eba5d' => 'state',
      'field_565713e2eba5e'	=> 'bedrooms'
    );
    

    These are field keys and field names for each field

    Make sure that you visit settings => permalinks and save it to make sure that you’re CPT archive is working.

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

The topic ‘Issue with Custom Field Filter’ is closed to new replies.