A good hook to check authorization and redirect?
I’m guessing the built-in template_redirect action is the best for this… 😀 http://codex.wordpress.org/Plugin_API/Action_Reference/template_redirect
I’m guessing the built-in template_redirect action is the best for this… 😀 http://codex.wordpress.org/Plugin_API/Action_Reference/template_redirect
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
Can you try adding the following code to the functions.php file in your theme directory and see if works for you function keep_raw_filename( $filename, $filename_raw ) { return $filename_raw; } add_filter( ‘sanitize_file_name’, ‘keep_raw_filename’, 10, 2 );
This can be achieved by using the admin_url filter: function add_new_post_url( $url, $path, $blog_id ) { if ( $path == “post-new.php” ) { $path = “post-new.php?param=value”; } return $path; } add_filter( ‘admin_url’, ‘add_new_post_url’, 10, 3 );
Your first method doesn’t work because you create a new instance of the class and try to remove the action from that new instance. That new instance you created is not the same instance that the action was added to, so it doesn’t work. In the second example, you get the original instance that was … Read more
I’m afraid I cannot replicate your problem. I’m uncertain as to why it is going wrong as I cannot see the loop that is being used, but a way that you could probably ensure it works is to adjust your function to accept a $post input: //Social Media function showSocialButtons( $post = null ) { … Read more
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
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
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
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