How can I get more out of `$post` in an `add_action` callback?

Simply use the post ID, provided by $post_id (and stored at $post->ID) to use the various functions WordPress provides to get any extra data related to that post (get_the_terms,get_post_meta etc). Performance wise you suffer no loss by using these functions as opposed to trying to force more data into the $post object (probably the reverse … Read more

update_user_meta not updating

In response to the extended question, i.e. Another question is[…]: It is worth noting that WordPress’ plugin API does not persist between requests – that is to say, any functions associated with actions through WordPress’ add_action() are only associated for the duration of the script’s execution. Each subsequent request served by WordPress must once again … Read more

add_action which contains first argument admin_print_scripts-$page

http://codex.wordpress.org/Plugin_API/Action_Reference/admin_print_scripts echos inline javascript in all admin pages header but http://codex.wordpress.org/Plugin_API/Action_Reference/admin_print_scripts-%28hookname%29 echos inline javascript in specific admin page header passed as second parameter.

Action inside another action not working

I think I worked out the problem. before_wp_tiny_mce_action is not an action hook called before the actual TinyMCE editor in the DOM. It is called before the script that is loaded via the admin_print_footer_scripts action. So I think the admin_footer action hook is before the before_wp_tiny_mce_action action hook so I am calling my action too … Read more

How can I get the user that publishes a post?

I am not sure if that is built in, but you can try adding something like this to your functions.php function set_publisher( $new_status, $old_status, $post ) { $publisher_id = get_current_user_id(); if ( $new_status == ‘publish’ && $publisher_id > 0) { update_post_meta($post->ID, ‘post_publisher’, $publisher_id); } } add_action( ‘transition_post_status’, ‘set_publisher’, 10, 3 ); And then when you … Read more

add_action before theme setup

setup_theme run on init theme, before after_setup_theme. The follow order on frontend, was fired in my test: load_textdomain plugins_loaded auth_cookie_valid set_current_user sanitize_comment_cookies setup_theme after_setup_theme init

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)