I changed “Howdy” in the admin bar in the dashboard, but when I’m viewing the site it still says Howdy!

I see a couple of problems here. This line if (!is_admin() || ‘default’ != $domain) return $translated; returns the Howdy right back unchanged if is_admin is false – which it is if you’re not in the dashboard. Also, you’re running your filter callback on gettext. This means it will be run every time some internationalized … Read more

radio button is checked but display not check

In the WordPress back-end you have to use checked=”checked” (stricter XHTML), because the CSS will not be applied otherwise: <input type=”radio” name=”colors” id=”blue” checked=”checked”> this is the CSS that applies the blue dot: WordPress already provides a function for this checked() <input type=”radio” name=”colors” id=”blue” <?php checked( ‘red’, get_option( ‘color’ ) ); ?> /> so … Read more

Allow role to delete posts but block him the wp-admin

Assuming you’re talking about a custom user role named “photographer“, I believe something like this should add the delete_posts capability to that role. function add_delete_cap_to_photog_role() { $role = get_role( ‘photographer’ ); $role->add_cap( ‘delete_posts’ ); } add_action( ‘admin_init’, ‘add_delete_cap_to_photog_role’); After adding the caps to the role, to solve the rest you could either keep blockusers_init and … Read more

Add confirmation popup on “Move to Trash”

You can try to admin enqueue this script, with jquery dependency: jQuery( function($) { $(‘.edit-php a.submitdelete, .post-php a.submitdelete’).click( function( event ) { if( ! confirm( ‘Are you sure you want to move the post to trash?’ ) ) { event.preventDefault(); } }); }); where we restrict the conformation on the a.submitdelete clicks to the .edit-php … Read more

Too few arguments sent to custom function

Your function needs 2 arguments, but you didn’t mention this to add_action add_action( string $tag, callable $function_to_add, int $priority = 10, int $accepted_args = 1 ) https://developer.wordpress.org/reference/functions/add_action/ By only passing the tag and function to add, PHP used the defaults for priority and accepted arguments, which were a priority of 10, and 1 accepted argument. … Read more