Ok – so, firstly you should know that it is a variable and not a function – in php this is indicated by the dollar symbol before the name: $variable
as opposed to function()
Second, you should note that $hook
is passed as a parameter to the function block – like so:
function_name( $hook ){
// this makes the variable $hook available inside the function - not globally.
echo $hook;
}
So, $hook
is actually passed to the function from the “hook” admin_enqueue_scripts which you can read on the codex page describes the value as $hook as:
Parameters
$hook_suffix
(string) The current admin page.
So, the answer is that $hook is not a global variable, nor a function ( essentially all WordPress functions are global, but that is another point ) – it is a local variable passed into the scope of the function hooked to the action.
Related Posts:
- Change the footer text on the login page
- How to remove a metabox from menu editor page?
- Check if page parent has certain template
- Hooking new functions to actions + passing parameters
- Insert all post IDs in new database table
- Randomise upload filenames (or another solution to hide the original image URL from theft?)
- Handling Body class based on Template
- Woocommerce: hook action/filter I could use to add variation id and price with each attribute opt on WooCommerce Rest api
- Why ajax doesn’t work on certain wordpress hooks?
- Is it possible to intercept all ajax requests and get the parameters and the returns?
- WordPress Gravatar filter is removing my custom attributes
- Error in custom php function doesn’t exist
- Generating an nonce for Content Security Policy and all scripts – How to make it match/persist for each page load?
- Return a numerical function value in Customizer controls
- Modify custom field input data before creating a new post
- how to make custom ajax handler?
- Omit custom post type from wp-sitemap.xml based on meta key using wp_sitemaps_posts_query_args
- Run a code only on theme activation only during first activation
- Theme not calling Jquery properly
- WordPress redirect redirecting too many times or not at all
- Why does the post_type_link hook everything twice?
- How to have different site identity logos on each page on Astra Theme [closed]
- How can I hook into the wp_mail function used by BackWPup?
- Get user custom field value on function.php
- Adding function to child theme’s function.php
- Must filter functions receive all arguments passed to them?
- Creating customized php files in theme folder
- Dynamically Generate Functions and Hooks
- How to pass hook variable to function?
- How do I add a function to parent theme
- Contain multiple page templates in one PHP custom template file in WordPress?
- Wp_Schedule_Event every few minutes doesn’t work
- Adding custom field to product category and show it to shop/category shop page
- Custom meta box is not displaying value showing tag as empty
- Discount in the specific product title using keyword ( Woocoommerce )
- How do I get the value of a current user’s custom field?
- Hook into all password resets in WordPress and get password before hashing?
- Getting page / post URL on publish and / or update
- Fatal error when using array_diff() function inside of wp_update_nav_menu hook?
- Why transition_post_type hook is called twice for the same post?
- WordPress HTML Helper
- Assign new post author IF another user in custom field on post transition
- Create and publish a new post every Monday, listing the post titles and links to the posts published during the previous week
- transition_post_status hook, works – but not if the post is new
- Is there a hook that I can use when a fatal error occurs?
- Custom plugin: Trying to show saved data on frontend
- How to call a function only once (global variable scope)
- Multiple is_page() in page.php
- Check php version before theme activation
- Fatal error: Call to undefined function plugin_dir_path()
- Switching wp_get_sites to get_sites
- Is it possible to get a theme customizer setting from wp.customize using jquery?
- How can update custom meta for all posts
- Executing `createimagefrompng()` from save_post hook (or equivalent hook)
- Delete option value from array using update_option()
- Check if term object is in array
- syntax issue on php 7.4
- How can I use wp_insert_comment to write a comment when a post is edited?
- How to remove the excerpt in the Dzonia Lite theme
- How do you add customer capability after Woocommerce purchase?
- Get first URL from post content
- Setting custom canonical urls
- How to put a variable in a instance in the widget
- How to output a PHP file values by shortcode?
- get a simple array of all of the term names that exist in all taxonomies
- Logged in user ID as post ID
- Show categories then when clicked on a category list all sub category and when clicked show all posts in that sub category
- How to store data from multiple forms using ajax and php
- How to control WordPress image metadata (using Imagick)?
- 3 Slashes appear after Apostrophe in custom fields after updating product-site
- Trying to retrieve post meta
- Need help enqueueing webfonts
- Error call_user_func_array() expects parameter 1 to be a valid callback when using image_size_names_choose
- Is it possible to return content, and then also continue to do other things?
- Need php code’s output to display underneath a Divi Module
- How to use mysql LIKE with wpdb?
- woocommerce related product title length
- Query for user roles
- Displaying Event within two given time frames
- How to call custom function outside from the admin page?
- Is there a way to create a “copy post” link?
- Use of antispambot with $curauth->email
- Reject all malicious URL requests functions.php
- Add custom field on admin dashboard comments / reviews
- front end editor creation for Restropress plug in – displaying information from a WP admin area, on a different URL
- Enqueue assets from multiple directories using add_action/do_action
- How to override WooCommerce Order Item Meta with data from Cart?
- Taxonomy Child Term, Counter is staying on 0
- Access to “My Site” is missing from the admin bar
- How to redirect (301) trashed post to it’s parent taxonomy TERM ARCHIVE instead of 404 page
- Using get_theme_mod with checkbox to display content
- Styling admin page rows in order of importance (checkboxes)
- Break a WordPress function to run in patches and re-continue
- Pagenav Not appearing on custom Template
- My title is showing after the shortcode
- Load a Header in wordpress
- Trouble figuring out how to get my button to submit comment
- Adding multiple conditional tags in a function?
- WooCommerce – Show ‘Sales’ badge on variable products where only some variations have sales price [closed]
- Alternative to php echo within code