Tag Info

Hot answers tagged

3

If you're logged into WordPress as an administrator, you can easily change the post author of a post to someone else. So what you'll want to do is set up different user accounts for your different authors and then set yourself up as an administrator. Then when you go to publish a post using your administrator account you can select which author you want it ...


2

Not allowed by design: If we try to change the user login by the email: wp user update mary@example.tld --user_login=mary_new or by the user id: wp user update 123 --user_login=mary_new we get the following warning: User logins can't be changed. This is the reason: if ( isset( $assoc_args['user_login'] ) ) { WP_CLI::warning( "User logins ...


1

User Meta Query with RLIKE: If the birth date is stored like dd/mm/yyyy, in the user meta, then you could find all August birthday users with the following meta query: 'meta_query' => [ [ 'key' => 'birthday', 'value' => '/08/', 'compare' => 'RLIKE' ], ] You could also consider storing the birthday month ...


1

I think the use of meta_query is in order: $user_query = new WP_User_Query( array( 'meta_query'=> array( array( 'key'=> 'birthday', 'compare' => 'NOT EXISTS' ) ) ) ); Basically, this looks for all users where the meta key of birthday doesn't have a value ...


1

Edit the user in phpmyadmin, enter the password as text in the user_pass field and there is a “Function” column with drop down boxes. On this field just select MD5 in the function column. When you save it phpMyAdmin will automatically md5 hash it for you.


1

You can try the map_meta_cap filter: /** * Uneditable posts/pages for editors */ add_filter( 'map_meta_cap', function ( $caps, $cap, $user_id, $args ) { // Edit to your needs: $post_ids = [123, 234, 345, 456]; // Uneditable posts $role = 'editor'; // Uneditable by this user role // Make given posts uneditable for the ...


1

search-replace does the trick but can have undesired side effects if old_login appears in other contexts in the database: wp search-replace old_login new_login But before doing that run wp sql dump wp search-replace old_login new_login --dry-run To make an SQL dump and see what is going to be replaced.



Only top voted, non community-wiki answers of a minimum length are eligible