Skip to main content

If you are using another query inside restrict_manage_posts make sure you add && $query->is_main_query() to your parse_query if statement, otherwise the parse_query filter will interfere with that second query.

if ( 'POST_TYPE' == $type && is_admin() && $pagenow=='edit.php' && isset($_GET['ADMIN_FILTER_FIELD_VALUE']) && $_GET['ADMIN_FILTER_FIELD_VALUE'] != '' && $query->is_main_query() ) { $query->query_vars['meta_key'] = 'META_KEY'; $query->query_vars['meta_value'] = $_GET['ADMIN_FILTER_FIELD_VALUE']; }

if ( 'POST_TYPE' == $type
      && is_admin()
      && $pagenow=='edit.php'
      && isset($_GET['ADMIN_FILTER_FIELD_VALUE'])
      && $_GET['ADMIN_FILTER_FIELD_VALUE'] != ''
      && $query->is_main_query()
) {
      $query->query_vars['meta_key'] = 'META_KEY';
      $query->query_vars['meta_value'] = $_GET['ADMIN_FILTER_FIELD_VALUE'];
}

If you are using another query inside restrict_manage_posts make sure you add && $query->is_main_query() to your parse_query if statement, otherwise the parse_query filter will interfere with that second query.

if ( 'POST_TYPE' == $type && is_admin() && $pagenow=='edit.php' && isset($_GET['ADMIN_FILTER_FIELD_VALUE']) && $_GET['ADMIN_FILTER_FIELD_VALUE'] != '' && $query->is_main_query() ) { $query->query_vars['meta_key'] = 'META_KEY'; $query->query_vars['meta_value'] = $_GET['ADMIN_FILTER_FIELD_VALUE']; }

If you are using another query inside restrict_manage_posts make sure you add && $query->is_main_query() to your parse_query if statement, otherwise the parse_query filter will interfere with that second query.

if ( 'POST_TYPE' == $type
      && is_admin()
      && $pagenow=='edit.php'
      && isset($_GET['ADMIN_FILTER_FIELD_VALUE'])
      && $_GET['ADMIN_FILTER_FIELD_VALUE'] != ''
      && $query->is_main_query()
) {
      $query->query_vars['meta_key'] = 'META_KEY';
      $query->query_vars['meta_value'] = $_GET['ADMIN_FILTER_FIELD_VALUE'];
}
Source Link

If you are using another query inside restrict_manage_posts make sure you add && $query->is_main_query() to your parse_query if statement, otherwise the parse_query filter will interfere with that second query.

if ( 'POST_TYPE' == $type && is_admin() && $pagenow=='edit.php' && isset($_GET['ADMIN_FILTER_FIELD_VALUE']) && $_GET['ADMIN_FILTER_FIELD_VALUE'] != '' && $query->is_main_query() ) { $query->query_vars['meta_key'] = 'META_KEY'; $query->query_vars['meta_value'] = $_GET['ADMIN_FILTER_FIELD_VALUE']; }