WordPress.org

Make WordPress Core

Changeset 13716


Ignore:
Timestamp:
03/16/10 17:22:24 (4 years ago)
Author:
ryan
Message:

Introduce taxonomies_allowed_in_menus and post_types_allowed_in_menus. Show only pages and categories by default. see #11817

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/nav-menu.php

    r13714 r13716  
    1717    if ( !$post_types ) 
    1818        return false; 
    19      
    20     foreach ( $post_types as $post_type ) {      
     19 
     20    $allowed_types = apply_filters('post_types_allowed_in_menus', array('page')); 
     21    foreach ( $post_types as $post_type ) { 
     22        if ( !in_array($post_type->name, $allowed_types) ) 
     23            continue; 
    2124        $id = sanitize_title_with_dashes( $post_type->label ); 
    2225         
     
    3841    if ( !$taxonomies ) 
    3942        return false; 
    40      
     43 
     44    $allowed_types = apply_filters('taxonomies_allowed_in_menus', array('category')); 
    4145    foreach ( $taxonomies as $tax ) { 
     46        if ( !in_array($tax->name, $allowed_types) ) 
     47            continue; 
    4248        $id = sanitize_title_with_dashes( $tax->label ); 
     49 
    4350         
    4451        // delete_transient( "nav_menu_items_{$tax->name}" ); 
Note: See TracChangeset for help on using the changeset viewer.