wp_ajax action responds with 0

Change your wp_localize_script-Call to the right Action: wp_localize_script( ‘addItemToNav’, ‘menuItems’, array( // URL to wp-admin/admin-ajax.php to process the request ‘ajaxurl’ => admin_url( ‘admin-ajax.php’ ), // generate a nonce with a unique ID “myajax-post-comment-nonce” ‘postCommentNonce’ => wp_create_nonce( ‘update_nav_items-nonce’ ), ‘action’ => ‘wp_ajax_update_nav_items’ ) ); As ‘action’ you currently Input the function Name, but that is wrong. … Read more

Problem in using Customizer

Hey Only Change the code like this function cult_customizer_register( $wp_customize ) { $wp_customize->add_section( ‘cult_topic_thumb’ , array( ‘title’ => __( ‘Topic of the Week’ ), ‘priority’ => 36, ‘description’ => ‘Allows you to upload an image for your topic of the week section.’, ) ); $wp_customize->add_setting( ‘display_topic_thumb’ ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, ‘display_topic_thumb’, array( ‘label’ => … Read more

Never actually adding the action? Or do I have to call the action?

You are using after_theme_switch action but the correct name is after_switch_theme. Also, you won’t see the echo statements on after_theme_switch and switch_theme. To debug things in that hooks you can use, for example, error_log() function and look for messages in PHP error log file (you need to have errors “On” and/or WP_DEBUG enabled). I’ve tested … Read more

Trying to write a function in an external php file to manage admin menu visibility

It’s becouse you’r calling alter_item function outside action admin_menu here’s working example i just made, try to figure what’s wrong with your’s by your self, if you fail i’ll explain add_action( ‘admin_menu’, ‘alter_items’ ); function alter_items() { global $current_user, $menu; get_currentuserinfo(); $scopes = apply_filters( ‘alter_items’, array() ); if( ! empty( $scopes ) ) { foreach( … Read more

Other than save_post any other actions on add / edit post screen?

you can use load-{page-hook}. It is called prior to the admin screen loading. add_action( ‘load-post-new.php’, ‘post_listing_page’ ); function post_listing_page() { // ‘add new’ page, you may have to check post type.. } {page-hook} on the ‘add new’ page of any post type, it is post-new.php {page-hook} on the edit page of any post type, it … Read more