WordPress Rewrite

assuming u is a custom query var, you have to first add it to the array of recognized query vars: function wpa_query_vars( $query_vars ){ $query_vars[] = ‘u’; return $query_vars; } add_filter(‘query_vars’, ‘wpa_query_vars’); Then add an internal rewrite rule that accepts anything appended to vendors and passes that as the u query var: function wpa_rewrite(){ add_rewrite_rule( … Read more

How to create user personal pages with information from their meta profile fields?

First of all register the cpt. Probably if you don’t want add the UI for that post type you can set the show_ui to false. $args = array( ‘label’ => ‘Members’, ‘public’ => true, ‘exclude_from_search’ => true, ‘show_ui’ => false, ‘show_in_nav_menus’ => false, ‘show_in_menu’ => false, ‘show_in_admin_bar’ => false, ‘hierarchical’ => false, ‘has_archive’ => true, … Read more

How to get profile user id when uploading image via media uploader on profile page

You need to pass the $profileuser->ID as the second argument when you call your function and define it accordingly: add_filter(‘wp_handle_upload_prefilter’, ‘my_pre_upload’, 2, 2); // (3rd param is priority, 4th is number of args) // and pass the $userid as argument to your function function my_pre_upload($file, $userid = false){ // if no user specified, get $current_user … Read more

Rename Buddypress Profile Tab

Look at the source, you know that already. 🙂 I didn’t but I bet there is a piece of code looking like this: _e( ‘Activity’, ‘buddypress’ ); … or … __( ‘Activity’, ‘buddypress’ ); Follow the functions, they are wrappers for the function translate() in wp-includes/l10n.php: /** * Retrieves the translation of $text. If there … Read more

How to change the link “Edit my profile”?

The filter hook edit_profile_url does that. It returns the URL and provides the User ID so you can use it for some customization of the new URL. add_filter( ‘edit_profile_url’, ‘modify_profile_url_wpse_94075’, 10, 3 ); /** * http://core.trac.wordpress.org/browser/tags/3.5.1/wp-includes/link-template.php#L2284 * * @param string $scheme The scheme to use. * Default is ‘admin’. ‘http’ or ‘https’ can be passed … Read more

How to hide fields from my user profiles

Since there unfortunately indeed is no filter for this part of the profile, you have got two options, a hypothetically existing plugin aside: 1. Remove the fields with js (as is exemplified with the nickname field below) jQuery(document).ready( function($) { $(‘input#nickname’).closest(‘tr’).remove(); }); 2. Output buffer the generated markup and modify it before serving In absence … Read more

How to Save Different Usermeta Fields According to User Role?

Observation: following the guidelines suggested in this article, I’m trying to improve the quality both of the Q and the A. It’s a learning process… In your original code, you were displaying different input fields according to the user role and other conditionals. add_action( ‘show_user_profile’, ‘user_fields_for_admin’, 10); add_action( ‘edit_user_profile’, ‘user_fields_for_admin’, 10); function user_fields_for_admin( $user ){ … Read more