wordpress ajax is not working for dropdown selection

The first issue I see is the ajax url is incorrect. Your wp_localize_script() has the handle name ‘main’, not ‘ajax_object’. url: main.ajaxurl Also, where is the callback code to handle the get_program_by_category ajax action? You’re missing two actions. add_action( ‘wp_ajax_my_action’, ‘my_action_callback’ ); add_action( ‘wp_ajax_nopriv_my_action’, ‘my_action_callback’ ); See the WordPress Codex to learn more about using … Read more

Embed Javascript code to registered users only

WordPress provides the Conditional Tags. I think is_user_logged_in() tag will work for you. List of conditional tags available. if ( is_user_logged_in() ) { // include the JavaScript File } UPDATE: Also if you want to check the user roles etc.. you can use the current_user_can() you can check both the both roles and capabilities. Better … Read more

Press This for Page

The press_this_save_post filter can be used to change the post type from post to page. Add the following code to your theme’s functions.php or a plugin: add_filter( ‘press_this_save_post’, ‘wpse244633_press_this_save_post’ ); /** * Filter the post data of a Press This post before saving/updating. * * @param array $post_data The post data. * @return array */ … Read more

Remove from a div by class name from post page if post author role is not administrator

Basically you are asking a function to check the post author role. You can use user_can() function. if(user_can(‘administrator’)) { //Write your code if the admin } current_user_can() : https://codex.wordpress.org/Function_Reference/current_user_can user_can() : https://codex.wordpress.org/Function_Reference/user_can

How to create a radio button to alt between settings in wp_options table

fist of all set radio two radio button and give a name related like “cf_current_list” and have you set save button if yes then set code in functions.php file like if(isset($_REQUEST[‘buuton_nm’])){ if ( get_option( cf_current_list ) !== false ) { // The option already exists, so we just update it. update_option( cf_current_list, $_REQUEST[‘radio_btn_nm’] ); } … Read more