How do I find all admin users using phpmyadmin?

We can generate the SQL with: $query = new WP_User_Query( [ ‘role’ => ‘Administrator’, ‘count_total’ => false, ] ); echo $query->request; that outputs: SELECT wp_users.* FROM wp_users INNER JOIN wp_usermeta ON ( wp_users.ID = wp_usermeta.user_id ) WHERE 1=1 AND ( ( ( wp_usermeta.meta_key = ‘wp_capabilities’ AND wp_usermeta.meta_value LIKE ‘%\”Administrator\”%’ ) ) ) ORDER BY user_login … Read more

Pre-fill fields with content from outside when creating a new post

An empty post is created by get_default_post_to_edit(). This function reads the post_title, content and excerpt values in the $_REQUEST array, and also filters them through default_title, default_content and default_excerpt. By default this function only returns a “fake” $post object, but if the $create_in_db parameter is set to true, it is actually saved in the database … Read more

Removing an admin page added by a 3rd party plugin. Gravity forms in this example

Ok, Eugene’s Answer works in the case of a plugin that doesn’t deals with custom capabilities. http://codex.wordpress.org/Roles_and_Capabilities The WordPress Plugin API allows Roles and Capabilities to be added, removed and changed. Since Plugins might change Roles and Capabilities, just the default ones are addressed in this article. So, if his code works without checking for … Read more

Disable wp-admin console for subscribers

You can remove the Read capability. That will prevent all access to wp-admin. function remove_read_wpse_93843(){ $role = get_role( ‘subscriber’ ); $role->remove_cap( ‘read’ ); } add_action( ‘admin_init’, ‘remove_read_wpse_93843’ ); See the note in the Codex about only needing to run this once. Then you need to hide the admin bar. function hide_admin_wpse_93843() { if (current_user_can(‘subscriber’)) { … Read more

How to change the wording in wp-admin back-end?

You can use the filter admin_post_thumbnail_html: function custom_admin_post_thumbnail_html( $content ) { return $content = str_replace( __( ‘Set featured image’ ), __( ‘Set featured image – 50 pixels by 50 pixels’ ), $content ); } add_filter( ‘admin_post_thumbnail_html’, ‘custom_admin_post_thumbnail_html’ );

post_mime_types Filter not Working in List Mode

The problem lies in the attachment-filter= URL parameter. The slash between application/pdf (or else) is being escaped twice. When you replace the %252F with a slash or %2F the filter will work. The first escaping (/ becomes %2F) happens when WP is building the selectbox containing the mime types. The second one (%2F becomes %252F) … Read more