New answers tagged

0

For current Wordpress version (4.5.3) I come up with the following solution which removes closing metaboxes handler and opens all previously closed metaboxes. php (plugin.php) function add_admin_scripts( $hook ) { wp_register_script( 'disable_metabox_toggling', plugin_dir_url(__FILE__) . 'index.js', 'jquery', '1.0.0', true); wp_enqueue_script( '...


1

You just need to move the capability check "inwards": function wpse_230369_quote_of_the_day( $user ) { $quote = esc_attr( get_option( 'quote_of_the_day' ) ); ?> <div class="visible-only-for-admin"> <h3>Quote of the Day Input Field</h3> <table class="form-table" > <tr> <th><label ...


0

add_filter('admin_footer_text', remove_admin_footer_text, 1000); function remove_admin_footer_text($footer_text =''){ return ''; } add_filter('update_footer', remove_admin_footer_upgrade, 1000); function remove_admin_footer_upgrade($footer_text =''){ return ''; }


0

The below ads an action to Wordpress that is run when the admin menu is rendered. The admin menu is an array and all you're doing, here, is adding an array element that defines a separator, in the position you specify. From here: add_action( 'admin_menu', 'set_admin_menu_separator' ); function set_admin_menu_separator() { $position = 79; global $menu; $...


0

You can also use add_meta_box to add predefined boxes to different places in the admin, as long as you know the right handles. In the case of the comments meta box you need: add_meta_box('commentsdiv', __('Comments'), 'post_comment_meta_box', $screen, 'normal'); Here post_comments_meta_box is the callback function that fills the metabox. I am supposing ...


0

The plugin that you need is "Admin Language Per User". Download the language pack of your choice from http://wpcentral.io/internationalization/ Extract the content into wp-content/languages (create the languages folder if it does not exist yet) Install and activate this plugin: https://wordpress.org/plugins/admin-language-per-user/ (Compatible up to: 4.5.2)...


0

The WordPress admin area uses capabilities to determine which user role can see what pages etc. You can use custom written code or several plugins to control to capabilities by each user. I'd suggest using the Members plugin for some easy control.


0

As long as you have SSH access you can write wp-cli based scripts to instull whatever you want. In theory you can also extend WHM/Cpanel to do that, but that is more of what hosting company will do and probably not relevant to "end users"


0

this one works for me, including the scripts on a customsubmenu page anyway: add_action('admin_menu', 'register_my_custom_submenu_pages'); function register_my_custom_submenu_pages() { $email_menu = add_submenu_page( 'edit.php?post_type=events', 'Email Users', 'Email Users', 'edit_others_posts', 'email', 'email_callback' ); add_action( '...


0

I improve the solution of @brasofilo as it is have small bug - on page reload with not best internet connection menu will appear for very short time. To avoid it I added a bit of more css: add_action('admin_head', 'wpse_52099_script_enqueuer'); function wpse_52099_script_enqueuer() { if(!current_user_can('administrator')) { echo <<<HTML <...


-2

After upvoting kaiser's answer I still feel the urge to point out that you are unlikely to write php code without DB access which will impact performance in a measurable way (unless you totally fuck it up). Theoretically speaking, the filter option should be more performant, especially in memory consumption (this is due to the fact core handles translation ...


4

Additionally to kaiser's answer, you can load customized .mo files that overrides the original file using load_textdomain_mofile filter. For example: add_filter( 'load_textdomain_mofile', 'cyb_filter_load_textdomain_mofile', 10, 2 ); function cyb_filter_load_textdomain_mofile( $mofile, $domain ) { if ( $domain == 'some-textdomain-to-override' ) { ...


4

Yes, you can use the gettext filter. No, it's not the fastest filter, but that is only true when you add a callback to that filter in the wild: Bad Example This is bad as it makes a string comparison for every of the hundreds of translatable requests in the current request: add_filter( 'gettext', function( $translated, $original, $domain ) { return '...



Top 50 recent answers are included