How can I remove the “Add New” button in my custom post type?

Please refer below : function disable_new_posts() { // Hide sidebar link global $submenu; unset($submenu[‘edit.php?post_type=CUSTOM_POST_TYPE’][10]); // Hide link on listing page if (isset($_GET[‘post_type’]) && $_GET[‘post_type’] == ‘CUSTOM_POST_TYPE’) { echo ‘<style type=”text/css”> #favorite-actions, .add-new-h2, .tablenav { display:none; } </style>’; } } add_action(‘admin_menu’, ‘disable_new_posts’);

Changing the ‘wp-admin’ URL to whatever I want

If you’re looking for a way to physically move the wp-admin folder to another location, that is indeed problematic. That’s why there is not an easy solution available. Not that it isn’t just easy, it is even the opposite. The directory name “wp-admin” is hardcoded deeply into wordpress. This is by design, so wordpress actively … Read more

How can I control the position in the admin menu of items added by plugins?

To change top level admin menu items order you’ll need two hooks, two filters, and one function. Put the following code in your current theme’s functions.php: function wpse_custom_menu_order( $menu_ord ) { if ( !$menu_ord ) return true; return array( ‘index.php’, // Dashboard ‘separator1’, // First separator ‘edit.php’, // Posts ‘upload.php’, // Media ‘link-manager.php’, // Links … Read more

do_shortcode() within Admin Page

Instead of calling do_shortcode() just call the function associated with the shortcode. Example There is a shortcode named [example] and a function registered as shortcode handler: function example_shortcode( $atts = array(), $content=”” ) { extract( shortcode_atts( array ( ‘before’ => ”, ‘after’ => ”, ), $atts ) ); return $before . $content . $after; } … Read more

Change page title in admin area

add_filter(‘admin_title’, ‘my_admin_title’, 10, 2); function my_admin_title($admin_title, $title) { return get_bloginfo(‘name’).’ &bull; ‘.$title; } You could also do a str_replace on $admin_title to remove “— WordPress” and change “‹”. Look at the top of the wp-admin/admin-header.php file to see what is going on by default.

Adding fields to the “Add New User” screen in the dashboard

user_new_form is the hook that can do the magic here. function custom_user_profile_fields($user){ ?> <h3>Extra profile information</h3> <table class=”form-table”> <tr> <th><label for=”company”>Company Name</label></th> <td> <input type=”text” class=”regular-text” name=”company” value=”<?php echo esc_attr( get_the_author_meta( ‘company’, $user->ID ) ); ?>” id=”company” /><br /> <span class=”description”>Where are you?</span> </td> </tr> </table> <?php } add_action( ‘show_user_profile’, ‘custom_user_profile_fields’ ); add_action( ‘edit_user_profile’, ‘custom_user_profile_fields’ … Read more