URLs of plugin resources?

I am trying to add in a script and css file for my plugin into the admin header. Then like any good developer you should be using wp_enqueue_script or wp_enqueue_style so you’re not hard-coding those script/style includes into the plugin(meaning a user can unhook them if he/she needed to). http://codex.wordpress.org/Function_Reference/wp_enqueue_script http://codex.wordpress.org/Function_Reference/wp_enqueue_style If the styles/scripts are … Read more

How to get the password and username of the add new user form (admin back end) in wordpress

You’ll need three hooks: 1: user_register This is for when the user is created via the admin back-end. The username will be available via $_POST[‘user_login’] and the password will be available via $_POST[‘pass1’]. 2: edit_user_profile_update This is for when the password is updated on the profile page by the user or admin. The username will … Read more

Displaying Post Title on Post Edit page?

This will do it: function edit_screen_title() { global $post, $title, $action, $current_screen; if( isset( $current_screen->post_type ) && $current_screen->post_type == ‘post’ && $action == ‘edit’ ) $title=”Edit ” . $post->post_title; } add_action( ‘admin_head’, ‘edit_screen_title’ );

Only allow new subpages to be created

Code based in Bainternet’s answer to this question: Make Categories and Tags required in admin See code comments. add_action( ‘admin_head-post-new.php’, ‘wpse_59770_publish_admin_hook’ ); add_action( ‘admin_head-post.php’, ‘wpse_59770_publish_admin_hook’ ); add_action( ‘wp_ajax_wpse_59770_pre_submit_validation’, ‘wpse_59770_ajax_pre_submit_validation’ ); function wpse_59770_publish_admin_hook() { global $current_screen; if( ‘page’ != $current_screen->post_type ) return; ?> <script language=”javascript” type=”text/javascript”> jQuery(document).ready(function() { jQuery(‘#publish’).click(function() { var form_data = jQuery(‘#parent_id’).val(); form_data = … Read more

Blocking Administrative Access to Authors and Subcribers?

Create a functionality plugin and use this if you want to completely block the access to the Admin panel: /** * Hide the admin bar in the front end */ add_filter(‘show_admin_bar’, ‘__return_false’); /** * Redirects Authors and Subscribers to the site front page using: get_home_url() */ add_action(‘admin_init’,’block_users_wpse_53675′); function block_users_wpse_53675() { if( !current_user_can( ‘delete_pages’ ) ) … Read more

Moving Categories submenu to Media, but still opens Posts menu

To add to what @brasofilo answered 3 years ago, this is what is necessary in the current menu system (WP v4.5.1). add_action( ‘admin_head-edit-tags.php’, ‘modify_menu_highlight_wpse_43839’ ); function modify_menu_highlight_wpse_43839() { if( ‘post_tag’ == $_GET[‘taxonomy’] ) { ?> <script type=”text/javascript”> jQuery(document).ready( function($) { $(“#menu-posts, #menu-posts a”) .removeClass(‘wp-has-current-submenu’) .removeClass(‘wp-menu-open’) .addClass(‘wp-not-current-submenu’); $(“#menu-media, #menu-media > a”) .addClass(‘wp-has-current-submenu’); }); </script> <?php } … Read more

Load Balanced WP with single server admin access

I work on a Load balanced instance of WordPress where all uploaded content is stored on a separate server and each WordPress server’s upload or blogs.dir folder is linked to that content server (a shared disk). Out of the box I do not believe there is way to force WordPress to use a single server. … Read more