When is get_currentuserinfo() needed?
Personally I would use wp_get_current_user(), no globals: function plugin_admin_init() { $user = wp_get_current_user(); }
Personally I would use wp_get_current_user(), no globals: function plugin_admin_init() { $user = wp_get_current_user(); }
Which hook to use to add notification message at beginning of my
We will use the admin_notices hook to display the information on top of the editor. First, a very basic example function educadme_fill_then_save_admin_notice(){ global $pagenow; if ( $pagenow == ‘post.php’ || $pagenow == ‘post-new.php’ ) { echo ‘<div class=”alert”> <p>This is some text. You can embed images, videos, whatever, and they will display on top of … Read more
Init hook for header send
I did end up figuring this out and went with 2) To keep it simple for content creators I told them to make sure the name of the transcript the same name for the pdf. When a new song comes in a playlist, I grab the text from the current track playing, parse the string … Read more
addaction hook cause redirection problem
Instead of $item[‘id’] I have to write $item. Fixed!
Depending on the way your theme uses the_title, hooking into the the_title filter may or may not hide the title h1. What theme are you using? The the_title filter passes two arguments: the title (string) and the post ID. Therefore, treating the title as an array (it looks like you’re assuming $title is an array … Read more
save_post runs too late to do what you are trying to do. That hook fires after the post and related meta data are stored. The category has already been removed at that point, and WordPress keeps no record. You will need to hook into the save process earlier, perhaps pre_post_update: add_action( ‘pre_post_update’, function($post_ID,$data) { var_dump($post_ID,$data); … Read more
It’s catch 22 – you need WordPress to use the hook system, but init will have already fired during load (wp-settings.php to be exact). I would create a MU “Must Use” plugin (wp-content/mu-plugins/any-filename.php) for all your “outside of WordPress” functionality, with something like this at the start: if ( ! defined( ‘LOADED_EXTERNAL’ ) || ! … Read more