WordPress Codesnippets

add pages to menu

				
					
				
			

This code is used to create a new top-level menu page in the WordPress admin panel. The $page_title and $menu_title parameters specify the text that will be used for the menu page and the $capability parameter specifies the user role that will have access to the page. The $menu_slug parameter is used to specify the URL slug for the page and the $function parameter is used to specify the callback function that will be used to render the page. The $icon_url parameter is used to specify the URL of the icon that will be used for the menu page and the $position parameter is used to specify the position of the page in the menu.

Was this code snippet helpful?
YesNo

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 »