How to show posts only for current category and not include childs, when view the re-order interface
For hierarchical taxonomies like Categories, the terms can take a parent-child structure scheme. This helps for a better organization of the customs port type objects assigned to the categories.
Sometimes, the themes and plugins, when query and outputs categories, specify a taxonomy argument called include_children. If set to TRUE, the query returns only direct post objects assigned to queries taxonomy term and not including the child of current terms ( which is the default behavior ).
If the case, the re-order interface is also required to show only direct assigned post objects, for easier sorting. This is easy to achieve through a custom filter apto/interface_query_args using the following code example:
add_filter( 'apto/interface_query_args', '_apto_interface_query_args', 10, 2 ); function _apto_interface_query_args( $args, $current_sort_view_ID ) { if ( ! isset ( $args['tax_query'] ) || ! is_array( $args['tax_query'] ) || count ( $args['tax_query'] ) < 1 ) return $args; foreach ( $args['tax_query'] as $key => $data ) { if ( ! is_array ( $data ) ) continue; $data['include_children'] = FALSE; $args['tax_query'][$key] = $data; } return $args; }
The above should be placed within child-theme functions.php file, a custom file on /mu-plugins/ folder, or a self-running plugin.