WordPress Codesnippets

add submenu page to custom post type menu


This code creates a submenu page for a custom post type. The page will have the title “Custom Post Type Submenu Page Title” and the menu title “Custom Post Type Submenu Page Menu Title”. The user must have the “manage_options” capability in order to access this page. The callback function for this page is “custom_post_type_submenu_page_callback”.

Was this code snippet helpful?

Leave a Reply

Your email address will not be published. Required fields are marked *

Programmatically save post

This code creates a WordPress post with the values of the ‘post_title’ and ‘post_content’ variables. It sets the post status to ‘publish’ and the author

Read More »

Create order programmatically

This code creates a new post in the WordPress database with post type ‘shop_order’, post title ‘Order #12345’, post status ‘wc-processing’, and ping status ‘closed’.

Read More »