WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#11704 closed feature request (worksforme)

conditional tag for admin panel

Reported by: F J Kaiser Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.8.5
Component: General Keywords: admin, panel, conditional comment
Focuses: Cc:

Description

I´m using wp_enqueue_style and wp_enqueue_script in my theme. At the moment these functions are only supposed to be used by plugins and not themes (right?). Now my stylesheets and scripts are loading in the back end panel too. Due to the fact, that i got a private area for users on my page, i can´t use is_user_logged_in to force scirpts&styles to get only loaded on my page.

It would be pretty handy to have an is_admin_panel conditional tag to check if you are on the page or in the back end.

Change History (1)

comment:1 Denis-de-Bernardy5 years ago

  • Milestone Unassigned deleted
  • Resolution set to worksforme
  • Status changed from new to closed

you can use is_admin() to only load them on the front end. and you should hook into wp_print_styles/wp_print_scripts to enqueue them.

Note: See TracTickets for help on using tickets.