Make WordPress Core

Changes between Version 4 and Version 5 of Ticket #23422, comment 7


Ignore:
Timestamp:
05/06/2016 11:31:20 AM (7 years ago)
Author:
tifosi
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #23422, comment 7

    v4 v5  
    99Essentially this filters the post-type list and only displays the posts associated to the selected taxonomy term. Nice feature when working with multiple terms per taxonomy. In theory & practice if you have a post-type and 3 taxonomies you can drill-down via this method with a select per taxonomy.
    1010
    11 Example code below I've used in my own framework:
     11Example code below I've used in my own framework. Note this was used in a class, so $this in code examples:
    1212
    1313{{{#!php
    1414<?php
    15 add_action( 'restrict_manage_posts', '_post_type_filter' );
    16 function _post_type_filter() {
     15add_action( 'restrict_manage_posts', array( $this, '_post_type_filter' ) ); //in __construct
     16public function _post_type_filter() {
    1717
    1818    //required presets
     
    5454{{{#!php
    5555<?php
    56 add_filter( 'parse_query', array( $this, '_post_type_filter_query') );
     56add_filter( 'parse_query', array( $this, '_post_type_filter_query') ); //in construct
    5757public function _post_type_filter_query( $query ) {
    5858