Front end post and upload file, image for users without plugin

Use wp_handle_upload in a custom function if ( $_FILES ) { upload_user_file($_FILES[‘test_upload’]); } if ( ! function_exists( ‘upload_user_file’ ) ) : function upload_user_file( $file = array(), $title = false ) { require_once ABSPATH.’wp-admin/includes/admin.php’; $file_return = wp_handle_upload($file, array(‘test_form’ => false)); if(isset($file_return[‘error’]) || isset($file_return[‘upload_error_handler’])){ return false; }else{ $filename = $file_return[‘file’]; $attachment = array( ‘post_mime_type’ => $file_return[‘type’], ‘post_content’ … Read more

WordPress /users/me endpoint request forbidden

The subset of data you are seeing is the publicly available author data. ie. if a user has published content on the site, their name, gravatar and description is deemed public data and available to un-authenticated requests. If you’re seeing this user data you can assume the access_token is invalid.

I want to change my user name

How friendly are you with databases? The simpliest way is to change it in database directly. You need to check table WP_users and WP_users meta. Everything else is according to ID of that user and gravatar is checking your email so there is no problem in changeing it in database. Unfortunately you can’t do it … Read more

Get usermeta info from sql query

You can use meta_query to specify what conditions you want to meet with that query you are performing. i.e.: // grab some record from DB with a specific meta query $args = array( ‘post_type’ => array( ‘woo_commerce_something’ ), ‘orderby’ => ‘rand’, ‘posts_per_page’ => -1, ‘meta_query’ => array( array( ‘key’ => ‘meta_something_woo_commerce_email’, ‘value’ => ’email@[email protected]’ ) … Read more

Custom comment field not showing when logged-in

I’m not sure I fully understand your question, but to add some HTML (just over or under the submit field) that is visible to both logged-in and logged-out users, you can try the following: add_filter( ‘comment_form_submit_field’, function( $submit_field ) { //———————————– // Adjust the prepend to your needs //———————————– $prepend = ‘<p> Prepend some HTML … Read more

Add a sub menu page to the Users menu

Happy New year to all. Happy to answer about wordpress in New Year. Hi, You are trying to link an admin page in navigation menu. Admin page can’t be accessed without logging in. Also the url wp-admin/users.php?page=business&user_id=2 can be accessed by user with id 2. If you wanted to create new page then go to … Read more