How to stop a user from updating the post date

As @t-f pointed out in his comment to question, you have an error on checking current user capability: ‘delete_published_posts’. $post_author_id simply doesn’t exist. After that, for your scope probably is a better hookin the filter wp_insert_post_data instead of the action save_post: because this one run when the post was already saved / updated, so if … Read more

User profiles and object associations

I don’t know Drupal, however, seems to me that what is “node” in drupal is “post type” in WordPress. By default WordPress has several post types: posts, pages, atthachments, menu items, revisions (these post types are often referred as “built-in”). You can register any number of custom post types, aka CPT. Post types, in database, … Read more

Disable plugins for a specific user role

Try this one. I just changed only current_user_can(‘contributor’) instead of is_user_logged_in(). add_filter( ‘option_active_plugins’, ‘disable_logged_in_plugin’ ); function disable_logged_in_plugin( $plugins ) { // The ‘option_active_plugins’ hook occurs before any user information get generated, // so we need to require this file early to be able to check for logged in status require (ABSPATH . WPINC . ‘/pluggable.php’); … Read more

How to assign capabilities to user NOT to User Role

Finally, I’ve figured out a way to do it using WP_user Class. Snippet to add/remove capability to/from specific user – //to remove capability from user $user = new WP_User( $user_id ); $user->remove_cap( ‘can_email’); //to add capability to user $user = new WP_User( $user_id ); $user->add_cap( ‘can_email’); There is special function in capabilities.php in the wp_user … Read more

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