Creating a custom register form

Ok, I found the solution. I placed the ‘wp_insert_user’ in a variable. And I used that variable to define the extra fields with ‘update_user_meta’. // If successful, register user $user_id = wp_insert_user($fields); update_user_meta( $user_id, ‘teste’, $fields[‘teste’] );

WordPress Shortcode based on other shortcode

Does the TOC need to be a shortcode? Perhaps giving the editors a meta box with a set of radio boxes for none, below and above options would be cleaner? You could then generate the TOC via the static variable approach you mentioned and output it during page render.

defined (‘ABSPATH’) false after AJAX post to other PHP-file

Follow these steps and you should be good to go:- Localize your script where you are implementing ajax(https://codex.wordpress.org/Function_Reference/wp_localize_script) Then make use of wp_ajax_{myfunction} (admin) and wp_ajax_nopriv_{myfunction} And lastly implement your code inside that function myfunction(){ /****Your code goes here*****/ } Eg. https://stackoverflow.com/questions/17855846/using-ajax-in-a-wordpress-plugin

How to get all users by user_login as a json_encode array?

Try this one: function prefix_get_users(){ $args=array( ‘blog_id’ => $GLOBALS[‘blog_id’] ); $all_users=get_users($args); $arr=array(); foreach ($all_users as $val) { $arr[]=$val->data->user_nicename; } die(json_encode( $arr )); } Reference: https://codex.wordpress.org/Function_Reference/get_users

Can’t get_users info by using json_encode

Try this code function get_users(){ $all_users = get_users(); $arr=array(); foreach ($all_users as $val) { $arr[]=array( ‘value’=> $val->data->user_nicename, ‘label’=> $val->data->display_name, ‘icon’ => get_avatar_url($val->ID)); } wp_send_json($arr); }