sort Posts by custom user filed

So, if you want to display only posts on your homepage, which interests the logged in user, you can use the pre_get_posts-Action: add_action( ‘pre_get_posts’, ‘wp123234_user_specific_loop’ ); function wp123234_user_specific_loop( $query ){ if( ! is_user_logged_in() ) //Just return, if the user is not logged in. return; if( ! $query->is_main_query() ) //If its not the main query return … Read more

Prevent registration except through form

I found a good answer and slightly modified it on a related question . It uses htaccess, and redirects any requests to wp-login.php?action=register. # BLOCK SPAM REGISTRATION REQUESTS (wp-login.php?action=register) <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{THE_REQUEST} ^.*(wp-login.php\?action=register).* [NC] RewriteRule ^(.*)$ http://isoreiki.com/about/account </IfModule> Notes: In the answer I linked to he totally blocked these requests. However I … Read more

User Registration – no Email required

Just install a plugin called – Snippets & Activate. Than on left panel click Snippets -> Add new. Type a title of your own & paste below code. After that click a option there in the bottom “Run snippet everywhere” and press Save/Active. That’s all you need to do. Enjoy… add_action(‘user_profile_update_errors’, ‘my_user_profile_update_errors’, 10, 3); function … Read more

Registration form not registering First and Last name

You’re not handling the names the same way as the other fields: //// VERIFIES CREDENTIALS $username = isset($_POST[‘username’]) ? trim($_POST[‘username’]) : ”; $first_name = isset($fields[‘user_first_name’]) ? sanitize_text_field(trim($fields[‘user_first_name’])) : ”; $last_name = isset($fields[‘user_last_name’]) ? sanitize_text_field(trim($fields[‘user_last_name’])) : ”; $email = isset($_POST[’email’]) ? trim($_POST[’email’]) : ”; Notice how you use $_POST[’email’] and $_POST[‘username’], but then you use $fields[‘user_last_name’], … Read more

generate an auto incremented id number when a new user is registered

You can use the same method as described in the link you mentioned, but simply use the created user ID and add 1000 so you get four digits. So user_id = 5 gets the meta number of 1005. add_action( ‘user_register’, ‘my_on_user_register’ ); function my_on_user_register( $user_id ) { $unique_id = 1000 + $user_id; update_user_meta( $user_id, ‘my_unique_id’, … Read more