[wp-hackers] custom post type post editor add_action script targetting

Mohammad Jangda batmoo at gmail.com
Mon Nov 8 16:16:55 UTC 2010


On Mon, Nov 8, 2010 at 11:05 AM, Philip M. Hofer (Frumph) <philip at frumph.net
> wrote:

> I'm trying to target the edit page for a specific post type for
> add_action('admin_print_scripts-' .<location here>
>

See Otto's answer here:
http://wordpress.org/support/topic/understanding-admin_print_scripts-page-hook#post-1172659
and
within your enqueue function, check current_screen for the post_type:

global $current_screen;

if( $current_screen->post_type == 'my-post-type' ) {

    // load scripts

}


(also see here for a cascading post type check:
https://gist.github.com/476964)


More information about the wp-hackers mailing list