Possible to search by author name with default WordPress search function?

Maybe you can try adding your condition directly in the query string, using something like this function wpse_29570_where_filter($where){ global $wpdb; if( is_search() ) { $search= get_query_var(‘s’); $query=$wpdb->prepare(“SELECT user_id FROM $wpdb->usermeta WHERE ( meta_key=’first_name’ AND meta_value LIKE ‘%%%s%%’ ) or ( meta_key=’last_name’ AND meta_value LIKE ‘%%%s%%’ )”, $search ,$search); $authorID= $wpdb->get_var( $query ); if($authorID){ $where = … Read more

Hook that get’s triggered when the author of a post is changed

There is no special hook to author change. But you can achieve it by using post_updated hook. Example: add_action(‘post_updated’, ‘prefix_on_update_author’, 10, 3); function prefix_on_update_author($post_ID, $post_after, $post_before) { if ($post_after->post_author != $post_before->post_author) { // author has been changed // you can add your own hook here or write your code } } Here is the codex … Read more

How to display a public profile page for registered users with custom slug?

Every registered user can have profile, they don’t need to have posts. To change WordPress author’s profile permalink, paste the following code in your functions.php: function change_author_permalink_base() { global $wp_rewrite; $wp_rewrite->author_base = “user”; } add_filter( ‘init’, ‘change_author_permalink_base’ ); After pasting the code, visit Settings->Permalink Structure under your wordpress admin, to flush the rewrite rules. This … Read more

WordPress Internal @ Mentions

This is a little tricky because sanitize_user allows spaces in usernames, meaning it difficult to avoid grabbing the whole phrase ‘@johndoe said that … ‘ as opposed to just the actual username ‘@johndoe’ and you have no separator at the end that would help. To avoid that I imposed a requirement that spaces in the … Read more

Extend WordPress search to include user search

You can’t achieve this easily with WP’s built-in search system. Even if you managed to build a complicated query that pulls data from the user table, it would be incredibly slow. Search Unleashed had this functionality, but I’m not sure about compatibility with WP 3.2. I used it in the past as inspiration to add … Read more

Change author permalink

you need 3 simple functions and hooks first change the author base: //change author/username base to users/userID function change_author_permalinks() { global $wp_rewrite; // Change the value of the author permalink base to whatever you want here $wp_rewrite->author_base=”users”; $wp_rewrite->flush_rules(); } add_action(‘init’,’change_author_permalinks’); then add users to query_vars: add_filter(‘query_vars’, ‘users_query_vars’); function users_query_vars($vars) { // add lid to the … Read more

How can HTML be allowed in Author Bio?

remove the filter that formats the description. put this in your theme’s functions.php: remove_filter(‘pre_user_description’, ‘wp_filter_kses’); EDIT – I should mention, if you allow random people to register and add their own bio for display on the site, not filtering that text could enable bad things.

Woocommerce: assign an “author” to a product

Simply use add_post_type_support: add_action(‘init’, ‘wpse_74054_add_author_woocommerce’, 999 ); function wpse_74054_add_author_woocommerce() { add_post_type_support( ‘product’, ‘author’ ); } User assigned with custom role Authors enabled in Products post type Another option, which I’m not sure of its correctness, it to hook into woocommerce_register_post_type* and register the post type first. This is a copy of the original function plus … Read more

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