Prevent from deleting any user role but subscriber

If you mean the delete button on the user list at /wp-admin/users.php, then that button is created by the WP_Users_List_Table class around (currently) line 256. If you look a little further down– a few lines– you will see a filter called user_row_actions. You can use that to hide the ‘delete’ link. add_filter( ‘user_row_actions’, function($actions, $user_object) … Read more

Add button in TinyMCE editor to insert text

Add this to your plugin file or in functions.php file in the theme directory add_action( ‘admin_enqueue_scripts’, ‘wpse_141344_admin_enqueue_scripts’ ); add_action( ‘admin_head’, ‘wpse_141344_add_mce_button’ ); function wpse_141344_admin_enqueue_scripts() { wp_enqueue_script( ‘wpse_141344-tinymce-scipt’, ‘url/to/your/custom-tinymce.js’ ); } function wpse_141344_add_mce_button() { if ( ! current_user_can( ‘edit_posts’ ) && ! current_user_can( ‘edit_pages’ ) ) { return; } add_filter( ‘mce_external_plugins’, ‘wpse_141344_add_tinymce_plugin’ ); add_filter( ‘mce_buttons’, ‘wpse_141344_register_mce_button’ … Read more

How can I make my Admin Icon SVG color correctly? [closed]

From Codex: $icon_url […] * Pass a base64-encoded SVG using a data URI, which will be colored to match the color scheme. This should begin with ‘data:image/svg+xml;base64,’. WordPress will change color of your SVG if you use SVG content instead of the file URL. (JS code responsible for changing the color is in svg-painter.js file.) … Read more

Hide a page in the admin end without a plugin?

you can use parse_query filter hook to exclude your pages using post__not_in attribute add_filter( ‘parse_query’, ‘exclude_pages_from_admin’ ); function exclude_pages_from_admin($query) { global $pagenow,$post_type; if (is_admin() && $pagenow==’edit.php’ && $post_type ==’page’) { $query->query_vars[‘post__not_in’] = array(’21’,’22’,’23’); } } this will exclude pages with the ids of 21,22,23 and to make sure this pages will not be included on … Read more

Add a button to users.php

Okay.. you COULD add a button like you mentioned; but I think this is going to require a lot more code. The users.php page is using the WP List Table class.. which means we can hook into the bulk actions and add our custom value there. So, let’s create a function to add a new … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)