Hide specific admin users’ posts

Try this – rather than redo all the hard work that WordPress does for the view links, just calculate all the posts for the admin you want to “hide” and subtract from the existing post counts: function wpse_229427_get_hidden_admin_id() { return 3; // You could make this a setting or return a value conditionally } function … Read more

REST API: How can I restrict a custom post type to only be accessible by authenticated users?

Looks like I found a snippet that do exactly that. It’s from Daniel Bachhuber, the API developer. add_filter( ‘rest_authentication_errors’, function( $result ) { if ( ! empty( $result ) ) { return $result; } if ( ! is_user_logged_in() ) { return new WP_Error( ‘restx_logged_out’, ‘Sorry, you must be logged in to make a request.’, array( … Read more

What exactly is WordPress?

Yes, you can run WordPress with your own domain if you purchase hosting for it. WordPress has system of Roles (which can be further enhanced via plugins), you can let users register and allow to perform actions accordign to their role. Essentially yes. You copy WordPress files to server and initiate brief installation procedure. First … Read more

How to update user role without logout

I think you are on the right track, wp_cache_delete was what finally helped me get an auto-signup with auto-login plugin working… I have this from there: wp_cache_delete($current_user->ID, ‘users’); wp_cache_delete($current_user->user_login, ‘userlogins’); Then see what roles you get after that with: $current_user = wp_get_current_user();

Read only capability for custom post in admin area

brasolfilo’s suggestion that you remove the submit meta box is only part of what I’d consider a complete solution. I can hack a “submit” button into that page using FireBug or any of a few other tools, in a matter of minutes. I would… Remove the meta box. This is brasofilo’s solution, and I won’t … Read more

Confusion with adding meta capabilities to a role after registering a Custom Post Type with corresponding ‘capability_type’ parameter

Have you tried defining the capabilities inside the external_roles_post_type_init() function? After the ‘capability_type’ => array(‘external_role’, ‘external_roles’), try add this ‘capabilities’ => array( ‘publish_posts’ => ‘publish_external_roles’, ‘edit_posts’ => ‘edit_external_roles’, ‘edit_others_posts’ => ‘edit_others_external_roles’, ‘delete_posts’ => ‘delete_external_roles’, ‘delete_others_posts’ => ‘delete_others_external_roles’, ‘read_private_posts’ => ‘read_private_external_roles’, ‘edit_post’ => ‘edit_external_role’, ‘delete_post’ => ‘delete_external_role’, ‘read_post’ => ‘read_external_role’, ), as another argument of the … Read more

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