Не работает базовая фильтрация. WordPress 5.0.3
-
Не работает стандартная фильтрация по записям, ни по дате ни по категориям
Версия wordpress 5.0.3.
Список активных плагинов:
Akismet Anti-Spam 4.1
All In One SEO Pack 2.10.1
Contact Form 7 5.1.1
Cyr to Lat enhanced 3.5
Easy Social Sharing 1.3.1
footnotes 1.6.5
Ivory Search 4.1.5
Jetpack by WordPress.com 6.9
Meta Box 4.15.9
User Role Editor 4.49
Wordfence Security 7.1.20Не работает — значит не фильтрует. К примеру я выбираю «ноябрь 2018» в фильтре по дате, строка запроса выглядит так:
wp-admin/edit.php?s&post_status=all&post_type=post&action=-1&m=201811&cat=0&post_format_admin_filter=0&filter_action=Фільтрувати&paged=1&action2=-1
но записи появляются последние за текущий(01.2019) месяц
По сети находил сообщения про
pre_get_posts
, у меня есть такое расширение, но шо с ним шо без него фильтрация не работает.function add_post_formats_filter_to_post_administration(){ //execute only on the 'post' content type global $post_type; if($post_type == 'post'){ $post_formats_args = array( 'show_option_all' => 'All Post formats', 'orderby' => 'NAME', 'order' => 'ASC', 'name' => 'post_format_admin_filter', 'taxonomy' => 'post_format' ); //if we have a post format already selected, ensure that its value is set to be selected if(isset($_GET['post_format_admin_filter'])){ $post_formats_args['selected'] = sanitize_text_field($_GET['post_format_admin_filter']); } wp_dropdown_categories($post_formats_args); } } add_action('restrict_manage_posts','add_post_formats_filter_to_post_administration'); restrict the posts by the chosen post format function add_post_format_filter_to_posts($query){ global $post_type, $pagenow; //if we are currently on the edit screen of the post type listings if($pagenow == 'edit.php' && $post_type == 'post'){ if(isset($_GET['post_format_admin_filter'])){ //get the desired post format $post_format = sanitize_text_field($_GET['post_format_admin_filter']); //if the post format is not 0 (which means all) if($post_format != 0){ $query->query_vars['tax_query'] = array( array( 'taxonomy' => 'post_format', 'field' => 'ID', 'terms' => array($post_format) ) ); } } } } add_action('pre_get_posts','add_post_format_filter_to_posts');
- Тема «Не работает базовая фильтрация. WordPress 5.0.3» закрыта для новых ответов.