There is a built-in function that you can use, instead of globals. The get_current_screen()
function allows you to get the information associated with the current page.
One of its return values is post_type
. So you can check against an array of post types to see if anyone matches.
function fhaac_admin_enqueue_scripts(){
$screen = get_current_screen();
if (
in_array( $screen->post_type, array('fhaac','blabla')) &&
$screen->base == 'post'
) { // Do something }
}
Related Posts:
- How to enqueue scripts on custom post add/edit pages?
- Load a script just to custom post type in admin
- Style custom columns in admin panels (especially to adjust column cell widths)
- How to localize value of posts
- Trying to add script to specific admin page is not working
- if custom posts type exists and there are posts load script
- custom fields cannt be seen with version 3.1
- One Site. One Theme. Multiple Stylesheets without plugins?
- Enqueueing TinyMCE
- Use conditionals with wp_enqueue_style to attach stylesheet according to post type displayed
- Loading a stylesheet on a specific page [duplicate]
- How to make sure, that only the selected post is changing?
- How do test if a post is a custom post type?
- Where to put my code: plugin or functions.php?
- What does this PHP function code mean? [closed]
- Remove slug from custom post type post URLs
- How do I Enqueue styles/scripts on Certain /wp-admin Pages?
- How to disable the single view for a custom post type?
- Custom post types, taxonomies, and permalinks
- Query all posts where a meta key does not exist
- How to create a permalink structure with custom taxonomies and custom post types like base-name/parent-tax/child-tax/custom-post-type-name
- How to get all taxonomies of a post type?
- How to sort the admin area of a WordPress custom post type by a custom field
- How to create a custom search for custom post type?
- Deregister custom post types
- Can I assign a template to a custom post type?
- Permalinks: custom post type -> custom taxonomy -> post
- Where is the right place to register/enqueue scripts & styles
- Should I use custom post types or a custom database tables for plugin development?
- Enable revisions for custom post type
- Extending the search context in the admin list post screen
- How do I query a custom post type with a custom taxonomy?
- Adding a Custom Post Type into the menu screen
- Pagination not working with custom loop
- How to Add Tags to Custom Post Type?
- How come Featured Image isn’t showing up in my Custom Post Type?
- Conditionally Loading JavaScript/CSS for Shortcodes
- Custom Post Type URL Rewriting?
- Add category base to url in custom post type/taxonomy
- Include custom taxonomy term in search
- Is It Possible To Add Custom Post Type Menu As Another Custom Post Type Sub Menu
- Adding ‘menu order’ column to custom post type admin screen
- Capabilities and Custom Post Types
- How do I dequeue a parent theme’s CSS file?
- Can the Next/Prev Post links be ordered by menu order or by a meta key?
- what is the correct way to compare dates in a WP query_posts meta_query
- Use register_post_type() to modify an existing post type
- Custom Taxonomy specific to a Custom Post type
- Check if a script/style was enqueued/registered
- Renaming Custom Post Types and Taxonomies
- wp enqueue style on specific page templates
- List all posts in custom post type by taxonomy
- Redeclare/Change Slug of a Plugin’s Custom Post Type
- Allow member to have access to custom post type only. Permission to only edit their own posts
- Mixing custom post type and taxonomy rewrite structures?
- Advanced search form with filters for custom taxonomies and custom fields
- Highlighting wp_nav_menu() Ancestor Class w/o Children in Nav Structure?
- Resolve a custom post type name vs. page permalink conflict (same slug)
- Get custom post_type’s archive URL
- Enable Gutenberg on custom post type
- Is there a way to get N number of WYSIWYG editors in a custom post type?
- Can multiple custom post types share a custom taxonomy?
- How to Add Custom Fields to a Custom Post Type?
- Hook for post and page load
- How to display value of custom fields in page
- Where are wordpress custom types stored?
- Using save_post to replace the post’s title
- Custom Post Type pages are “not found”
- Possible to hide Custom Post Type UI/Menu from specific User Roles?
- How do I safely change the name of a custom post type?
- Custom post type single page returns 404 error
- Change “Enter Title Here” help text on a custom post type
- Hide content box with Custom Post Type?
- Change the text on the Publish button
- WP REST API fetch posts from post type
- Remove taxonomy slug from a custom hierarchical taxonomy permalink
- Adding categories to custom post type in permalink
- Display all posts in a custom post type, grouped by a custom taxonomy
- How do you use a CPT as the default home page?
- get_terms by custom post type
- single-{$post_type}-{slug}.php for custom post types
- How do you use orderby with meta_query in WordPress 3.1?
- Custom post type single-{custom}.php not working
- How to get custom post type post id from slug?
- Programmatically publish a post (custom post type) with custom fields
- How to Add a Sub Menu Page to a Custom Post Type?
- How to load css in the footer [duplicate]
- Prevent post from being published if custom fields not filled
- WP_Query Pagination on single-custom.php
- With Rest V2 (WP4.7) how does one restrict certain RESTFUL verbs?
- Remove Custom Taxonomy Metabox from Custom Post Type Screen
- Is it possible to remove WYSIWYG for a certain Custom Post Type?
- Multiple orderby values in WP_Query
- Placing a Custom Post Type Menu Above the Posts Menu Using menu_position?
- How can I get a list of all enqueued scripts and styles?
- How do I get the permalink of a custom post type?
- Custom post type – order field
- How to remove custom post type archive
- Row actions for custom post types?
- How to set parent-child relationship between differents custom post types