Remove menu items for non admins
function TRIM_ADMIN_MENU() {
    global $current_user;
    if(!current_user_can('administrator')) {
        remove_menu_page( 'tools.php' ); // No tools for <= editors
        remove_menu_page( 'activity_log_page' ); // Activity log
    }
}
add_action('admin_init', 'TRIM_ADMIN_MENU');

WordPress unregister post type
if( !function_exists( 'plugin_prefix_unregister_post_type' ) ) {
    function plugin_prefix_unregister_post_type(){
        unregister_post_type( 'project' );
    }
}
add_action('init','plugin_prefix_unregister_post_type');

WordPress remove “posts” post type
function remove_default_post_type() {
  remove_menu_page( 'edit.php' );
}
add_action( 'admin_menu', 'remove_default_post_type' );

Create New Post Type – WordPress Native
function create_posttype() {
  register_post_type( 'wpll_product',
    array(
      'labels' => array(
        'name' => __( 'Videos' ),
        'singular_name' => __( 'Video' )
      ),
      'public' => true,
      'has_archive' => true,
      'rewrite' => array('slug' => 'videos'),
    )
  );
}
add_action( 'init', 'create_posttype' );
CSS Prevent href=”url” event
a {pointer-events: none;}

Search

Your Favourite Posts

  • Your favorites will be here.

Latest Content

© Garth Baker 2025 All rights reserved.

Pin It on Pinterest

Share This