[wp-hackers] enqueue script only on settings page?
jgadbois at gmail.com
Tue Sep 21 17:30:42 UTC 2010
But can't you add a settings page just by calling register_settings without
actually ever calling an add page function? I was wondering how to do it in
On Mon, Sep 20, 2010 at 12:17 PM, Otto <otto at ottodestruct.com> wrote:
> On Mon, Sep 20, 2010 at 8:33 AM, John Gadbois <jgadbois at gmail.com> wrote:
> > Is it possible to enqueue a script or style only on a settings page
> > via the settings api?
> When you add a new settings page, you do this via a call to
> add_options_page, or add_submenu_page, or add_whatever_page. One of
> the things you specify in these calls is the $menu_slug. This gets
> added to the URL when you see your page in the admin screens. So the
> URL of your page ends up being
> That "whatever" is key here. You can use the action hook of
> "admin_enqueue_scripts" to enqueue your scripts, and the first
> parameter passed to it will be that "whatever". Check for that, and
> enqueue as you see fit.
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers