Admin Panel – Custom Menu Sub-Item LINK

Insert the URL of the page as the $menu_slug argument. Also note that user levels are deprecated, you should pass a capability instead. function add_custom_link() { add_submenu_page( ‘edit.php?post_type=cpt_custom’, ”, ‘Pending Posts’, ‘edit_posts’, ‘edit.php?post_type=cpt_custom&post_status=pending’, ” ); } add_action(‘admin_menu’, ‘add_custom_link’);

How to use the same code for multiple pages?

Please show us your actual code, and don’t just describe what you implemented. In this particular case, it is vital to see how you tried to implement two occurrences of the code. Anyway, from what I understand, the following function should do what you’ve asked for: add_action(‘wp_trash_post’, ‘wpse_136052_do_not_delete’); function wpse_136052_do_not_delete($id) { if (in_array(get_post($id), array( get_page_by_title(‘About’), … Read more

Customise WordPress Update Notice in wp-admin backend area

I did not find any hook available to customize the message. So decided to remove the original update nag and have our custom nag over there. Lets first remove the original nag // Admin menu hook add_action( ‘admin_menu’, ‘remove_core_update_nag’, 2 ); /** * Remove the original update nag */ function remove_core_update_nag() { remove_action( ‘admin_notices’, ‘update_nag’, … Read more

Extend Screen Options

To change or extend the functionality of WordPress Core, WordPress relies heavily on actions and filters. I’ll assume you have basic knowledge of this, and if you don’t, you will after reading up on it in the Codex. render_screen_meta is a public method of the WP_Screen object. You can’t overwrite is by defining the function … Read more

New wordpress install, what are the reasons the “Install Themes” tab is missing?

One of possible reason is you/automated installation might have turned off installation of new themes and plugins in wp-config.php. Make sure you do not have DISALLOW_FILE_MODS true in your wp-config.php file. define( ‘DISALLOW_FILE_MODS’, true ); If it is then remove this line. Enabling this option in config file will disallow updates and installations of new … Read more

WordPress Admin – Add Edit link to specific page under Pages Menu

Try add_action( ‘admin_menu’, ‘wpse182102_register_my_custom_menu_page’ ); function wpse182102_register_my_custom_menu_page() { add_pages_page(null, ‘Menu Item Name’, ‘edit_posts’,/* or whatever capability required for this object */ ‘/post.php?post=”.get_page_by_title(“Etusivu’)->ID.’&action=edit’, null, ”); } And change Etusivu to be the name of the page you want to edit.

Modify users.php page to create page/post on button clicked

Use wp-admin/admin.php with an action parameter: <a href=”https://wordpress.stackexchange.com/questions/184153/<?php echo esc_url( admin_url(“admin.php?action=wpse_184153_create_page&user_id=$user_id” ) ) ?>”>Create Page</a> And then hook onto the event: function wpse_184153_create_page() { $redirect = admin_url( ‘users.php’ ); if ( ! empty( $_GET[‘user_id’] ) && $user = get_userdata( ( int ) $_GET[‘user_id’] ) ) { // Create your page // Add any URL parameters … Read more

Redirect non-admin users away from wp-admin/index.php (main dashboard page) to wp-admin/profile.php

The easiest solution is to hook in load-index.php and redirect non-admin users to their profile. Effectively blocking access to that page. I’m going to wrap the permission check up in a function for this example (we’ll use it more than once). function _wpse206466_can_view() { // or any other admin level capability return current_user_can(‘manage_options’); } add_action(‘load-index.php’, … Read more

Limit access to wp_admin

IMHO this is not the best method of protecting your WP Admin. IPs can be spoofed. This method also restricts you to specific IPs which can be annoying if you wish to access it from a different office/location. I’d recommend either a simple server-based password protection on the wp-admin directory. Of course, the downside is … Read more