How to edit custom user meta information front end

I have solved it. In the redirect I changed if (count($error) == 0 ){ to if (count($error) < 1 ){ Also for any custom user meta fields added duplicated the following line and change the word ‘description’ to the name of the field create in your function file. if ( !empty( $_POST[‘description’] ) ) update_user_meta( … Read more

Set meta_key and meta_value for all registered user in wordpress using sql query [closed]

Add this code in functions.php. visit your site you, it will automatic add/update all user meta value. After executing this code just comment out or remove this code. $args = array( ‘fields’ => ‘all’, ); $blogusers = get_users( $args); foreach($blogusers as $key => $user){ update_user_meta( $user->ID, ‘is_activated’, 1 ); } OR you can also do … Read more

Filter Author Bio

You can use the filters the_author_$meta and get_the_author_$meta (where $meta is in this case ‘description’): add_filter(‘the_author_decription’, ‘custom_about_member’, 10, 2); add_filter(‘get_the_author_decription’, ‘custom_about_member’, 10, 2); function custom_about_member($description, $userid) { $about = get_user_meta($userid, ‘user_about’, true); if ($about) {return $about;} return $description; } This of course relies on the place where the author bio is being displayed using the … Read more

Modify Database in Multi-Site wp_usermeta table

This Should Work? ALTER TABLE wp_usermeta ADD COLUMN old_user_id bigint(20) unsigned; INSERT INTO wp_usermeta (old_user_id) SELECT u.id FROM wp_users AS u; INSERT INTO wp_usermeta (user_id, meta_key, meta_value) SELECT u.id, ‘wp_2_capabilities’, meta_value JOIN wp_users AS u ON u.user_id = u.old_user_id; ALTER TABLE wp_users DROP COLUMN old_user_id;

How can I get the author description’s excerpt?

There is none. You have to implement your own custom function to trim any content you wish. For example, this function will trim your content based on words: function my_custom_excerpt ( $content, $limit = 20, $more=”…” ){ return $data = wp_trim_words( strip_tags( $content ), $limit, $more ); } Or this one will trim it based … Read more

create shortcode to list users with specific meta key value

Try this: function thebroker_agents() { global $current_user; $bmail = $current_user->user_email; $user_query = new WP_User_Query( array( ‘meta_key’ => ‘broker_email’, ‘meta_value’ => $bmail, ‘fields’ => ‘all’ ) ); $users = $user_query->get_results(); if (!empty($users)) { $results=”<ul>”; foreach ($users as $user){ $results=”<li>” . $user->display_name . ‘</li>’; } $results=”</ul>”; } else { $results=”No users found”; } wp_reset_postdata(); return $results; } … Read more

Adding current user’s ID to the end of PDF hyperlinks in post content

Here’s a solution that I came up with that will add the user query argument and the current user’s ID to PDF links, e.g.: http://mysite/wp-content/uploads/2018/12/My_PDF_File.pdf?user=54 This code works by inspecting the post’s content using the the_content filter, then parsing the content using DOMDocument. I’ve run into various gotchas using DOMDocument and much of this code … Read more