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); }

how can I disallow special characters, space, capital letter, dot in user name on registration?

please try below function for disallow special characters, space, capital letter, dot in user name on registration //add a filter to invalidate a username with spaces,special characters, capital letter, dot add_filter(‘validate_username’,’restrict_space_in_username’,10,2); function restrict_space_in_username($valid,$user_name){ //check if there is an space if ( preg_match(‘/\s[!@#$%^&*()+=\-\[\]\’;,.\/{}|”:<>?~\\\\][A-Z](.)/’,$user_name) ) return false;//if myes, then we say it is an error return $valid;//otherwise … Read more

Can we use corePHP code in wordpress?

Yes, you can use ‘normal PHP’. It is not necessary to use object-oriented PHP. Also, WordPress is not all OOP, a lot of it is just functions and functional based programming.

How to do a MySql query in WordPress?

You can write your own MySQL queries by getting the global $wpdb variable and preparing a SQL statement and then getting the results. global $wpdb; $prepared_query = $wpdb->prepare( ‘SELECT * FROM [your_table] WHERE LAST_INSERT_ID();’ ); $results = $wpdb->get_results( $prepared_query ); Please, be very careful when using this, if you do it incorrectly, it could be … Read more