How can I pass get_the_author_meta(‘user_email’) through the REST API?

Why I Don’t Have Access to Post’s Information? When you are using Admin-AJAX or the REST API, you will only have access to the current user’s data (by that I mean by default, such as using is_user_logged_in()). To retrieve any other information, you have to pass it as an argument in your AJAX request. WordPress … Read more

How can i upload images in an admin page?

First of all edit_user_profile and show_user_profile action hooks don’t have to save the image, you can just add a field there. So function image_up_gall(){ ?> Select image to upload: <input type=”file” name=”fileToUpload” id=”fileToUpload”> <input type=”submit” value=”Upload Image” name=”submit”> <?php } add_action(‘edit_user_profile’, ‘image_up_gall’); add_action(‘show_user_profile’, ‘image_up_gall’); It is because WordPress has its own form tag already, just … Read more

How To Change Logout Screen Title

First of all, if you see this page it means you’re doing logout in a wrong way. The check_admin_referer() fails and calls wp_nonce_ays(), thus prompting for a confirmation (ays = Are You Sure?). See these threads for more details: How to log out without confirmation ‘Do you really want to log out?”? WordPress failure when … Read more

Custom filter in admin edit custom post type responding with invalid post type?

I am also get the issue same as you and finally I got the solution. We have to add $query->is_main_query() in IF CONDITION. if( ‘trip’ == $type && is_admin() && $pagenow==’edit.php’ && isset($_GET[‘tripstatus’]) && $_GET[‘tripstatus’] != ” && $query->is_main_query()) { $value = $_GET[‘tripstatus’]; $query->query_vars[‘meta_key’] = ‘trip_status’; $query->query_vars[‘meta_value’] = $value; } I hope it will help … Read more

Custom delete option button in plugin settings

I managed to add delete button this way, it also may be used to add any extra submit button. Create a submit button with name and array attribute: function mw_options_wc_order_attachement_1() { ?> <input type=”file” name=”mw_options_wc_order_attachement_1″ id=”mw_options_wc_order_attachement_1″ value=”<?php echo get_option(‘mw_options_wc_order_attachement_1’); ?>” /> <?php echo get_option(“mw_options_wc_order_attachement_1″); ?> <input type=”submit” name=”submit[delete_attachment_1]” class=”button button-primary” value=”Delete” /> <?php } Register … Read more