PHP code example of frozzare / wp-content-menu

1. Go to this page and download the library: Download frozzare/wp-content-menu library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

frozzare / wp-content-menu example snippets


// With `register_post_type`
register_post_type( 'book', [
  'content_menu' => true
] );

// With the filter.
add_filter( 'content_menu_post_types', function ( $post_types ) {
  return ['page', 'post', 'book']
} );

add_filter( 'content_menu_add_new_item_label', function ( $label ) {
  return 'Add New';
} );

add_filter( 'content_menu_user_allowed', function ( $allowed, $user ) {
  return false;
}, 10, 2 );