The $hook_suffix
global (copy of which you are getting passed to the hook) doesn’t go into such detail.
However there is plenty more of context to check. In modern WP versions bulk of it is via get_current_screen()
which returns WP_Screen
object with plenty of stuff (in this case you would want to check id
and post_type
properties likely).
As for post’s ID — get_the_ID()
should work perfectly fine in that context.
Related Posts:
- Simple/basic use of get_current_screen
- How to add background image control to page admin controls?
- Is my code correct to enqueue CSS on a specific page?
- This code works, but the way I integrated it is breaking the media uploader. How can I integrate it properly?
- How can I append and prepend something to all post hyperlinks without using ::before or ::after? PHP hook solution?
- Issues with title-tag and document_title_parts
- How to load scripts/styles specific for a page
- Import WordPress XML File from Within Functions.php
- Define custom Page Template without its own .php file
- Does hooking into the same action multiple times drain memory?
- How to influence the information displayed on widget inside wp-admin
- Extract image from content and set it as the featured image
- functions.php inject inline css
- Is there a hook or function I can use to display all theme files being used on a current page?
- Issue with get_theme_mod returning a blank value instead of the saved value
- Add action hook conditionally – only when home.php in use
- Show modified time if post is actually modified
- why doesnt is_home() work in functions.php
- How do I create a new WP admin color scheme?
- How to create thumbnails for PDF uploads?
- Logout/login redirect CSS issue
- Implementing DNS Prefetching with WordPress
- Help me to understand wp_header() and wp_footer() functions
- How can I tell if I’m on a login page? [duplicate]
- In WooCommerce I need to modify the thankyou.php page [closed]
- How can I add an extra WooCommerce hook
- Why get_header() or get_footer() does not run twice if called in the same php file?
- Add attribute to link tag that’s generated through wp_register_style?
- TinyMCE custom stylesheets for different post types
- Remove Page Title from Static Frontpage
- How to override WordPress registration and insert an auto-generated username?
- Set default options for inserting media
- Change parent theme file function in child themes functions.php
- Adding extra SVGs to TwentyNineteen child theme using class TwentyNineteen_SVG_Icons
- How to hook into the quick edit action?
- Remove “says” from comments
- gform_after_submission content appears immediately after , not in post body [closed]
- How do I change parameters without changing the core
- How to add CSS style sheet dynamically in wordpress
- Child Theme Not Overriding Parent Theme
- CSS stylesheet not loading
- WooCommerce add_action hook results in 500 error
- Issue adding text after short description on product pages Woocommerce [closed]
- Enqueue styles after a plugin
- Customize “the_posts_pagination” and put list instead div
- Increment price for Woocommerce Minicart [closed]
- how to change link of some wordpress pages
- Gravity Forms field entries into wp_query loop [closed]
- Post thumbnail relative link and HTML modify
- Proper way of using functions in action hook?
- Add class or ID to any WordPress function
- How to preserve edits to Name or Slug of term when using wp_update_term on save?
- Accepted arguments value in hook functions
- Get current page_id before loop, in functions.php
- Register and enqueue style.css custom theme
- Multiple CSS body classes to specific page I.D.’s – is this possible?
- How to properly add function called by action-hooked function to functions.php?
- Which action hook to use for function?
- Change size and crop medium_large images
- Gravity Forms – Using a Form to Pre-populate A Gravity Form [closed]
- Running a script before absolutely everything
- Inserting a functions output after the content
- How to display post content instead of excerpt
- Add function to every post?
- Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘greenday_head’ not found or invalid function name
- Enqueue Style Only On Certain Pages Not Working
- Why does the ‘wp_nav_menu’ function work only until a menu is created?
- Modify a function without editing template
- Don’t delete a page if it holds users
- Child Theme files – what is needed?
- How do I add Bootstrap and LESS to my migrated WordPress site?
- Problem only while using require_once() within functions.php
- Passing values from a widget to a function within a plugin
- How to Display Frontend CSS for Administrator only
- Which action does wp_update_user triggers?
- How can I get my Script to work on the Login page?
- Trigger a custom function when option are saved in admin area
- Execute a ultimate member action when user role is updated
- WordPress Menuing Question :focus
- Add other social networks to TwentyNineteen_SVG_Icons class in child theme?
- How to use wp_trash_post (or wp_delete_post) for deleting a (or all) post(s) from custom post type?
- change the url paths in the stylesheet dynamically
- What did I do wrong in my functions code, that will not change the “Get New Password” text to “Send It”?
- Please Explain the Importing Process of Multiple Stylesheets for Child Themes
- Replace a menu with widget or a custom template file programmatically
- Footer disappears when using the_content ( )
- Get User Login Data (date, time… )
- Registration Hooks don’t appear to be working
- Change CSS for logged in users
- jQuery does not work
- Why does re-using this function not work? [closed]
- How to stop wordpress from injecting hard-coded style into image attachments with captions
- Pass parameter to hooked function using custom page template
- different style sheet for just one page template
- Override the WordPress core function wp_referer_field
- How to return hook data when multiple parameters are present?
- Hook into a function without a hook?
- Custom styles.css sheet for visual editor
- What is the text that appears beside the page titles in the list of pages in the WP admin?
- How to edit the Tags within the image file URLs?