Depends on whether or not you need to check against WordPress’ user authentication. If you need to know whether they’re a logged in user, hook onto 'init'
. Otherwise, the sooner the better.
If it’s something that should fire on every page load, and only checks for existence of the cookie and doesn’t need to tap into any of WP’s APIs, I’d put it into a custom MU-plugin named 0000a.php
to ensure that it fires before any non-core files could accidentally send headers.
Related Posts:
- Find variables available at a given hook
- Why do filters/actions require an argument count?
- How to use return in my custom function instead of echo
- add_action shortcut?
- Is it acceptable to treat a filter like an action?
- Contact Fom 7 – how to add custom HTML inside span.wpcf7-form-control-wrap AND IMMEDIATELY AFTER input.wpcf7-form-control?
- Insert custom PHP head above in WP pages
- Override a function defined in wp-includes/comment-template.php
- Add meta tags to a custom header
- Dynamically adding filters
- setcookies and header send
- How to internationalize header image?
- How to remove get_header From all single pages in wordpress with functions.php without plugin?
- I want to hide “sold by” on certain pages with id page 43
- How to add custom checkout field in user details mail template
- Cannot modify header information – headers already sent
- How to change wp-admin and wp-login urls
- Is there a hook that I can use when a fatal error occurs?
- How to make a image-size selected by default in Media upload – WP v3.5
- Permanently remove first image from posts
- Change the footer text on the login page
- add_filter to post-gallery and remove all ‘s?
- Can i check if user is doing any ajax request?
- Rewriting search and pagination base
- Change comments form title on a page by page basis
- How to stop loading multiple copies of jquery
- Remove class that has been added by parent theme
- Why isn’t my if/elseif/else working correctly here?
- Why is PHP Cookie via plugin only set when logged in as Admin and not regular users? and other questions
- Hooking new functions to actions + passing parameters
- How do I know what variables are passed in a filter/action and what their meaning is?
- How to add Shortcode (font awesome) in widget title?
- save_post vs post_updated
- Woocommerce filter cart and category specific quantity [closed]
- Wrap First Character after in a tag
- WooCommerce: Add Payment Gateway Field to Webhooks [closed]
- action hook wp_head higher priority as all other plugins/hooks
- How to add custom post meta to default blog post?
- Problem adding class to body_class
- Run a filter when a walker runs
- Remove an action hook within a Class
- Nesting if statements to echo only one string based on what tag was filtered?
- How to properly loop through these external URLs to get them into the sitemap using this hook
- Input type search in Menu
- Ajax – Call to undefined function get_option()
- How can I remove a function that has been added to wordpress with add_filter?
- Edit incorrect password message WordPress
- Why does my callback function not work with this custom filter hook?
- Responsive Header for Phone
- Generating an nonce for Content Security Policy and all scripts – How to make it match/persist for each page load?
- how can i use $_COOKIE[] + PostID to execute the below code?
- Unique icons next to each WordPress menu item
- wp-comments-post.php file returns a blank page
- Problem with login form
- Headers already sent in Pluggable.php / homepage and wp-login error
- Is_front_page inside header.php is always returning true
- Moving code from theme header to functions.php
- WordPress wp_redirect error
- My php code is not being executed
- Content filter won’t work
- Warning: in_array() null given in PHP function
- Upload multiple files in randomly generated folder using wp_upload_bits
- $_SESSION variable not saving on page refresh or new page
- How do I create a secondary version of the_content
- Action Hook Inside WordPress Plugin Shortcode
- Displaying content on posts page based on category
- How to set cookies
- Can I remove or edit an include() from a function with a filter?
- How would I use a filter to remove header banner on certain post types
- WordPress doesn’t load HTML
- How to sort WooCommerce products page by latest in-stock items first?
- How do I make these combination select filters work when only one dropdown is set? They work in WordPress 5.8.2 but don’t in 5.8.3
- Show related products by attribute based and certain conditions
- Change the “Show All” button in a WordPress Portfolio Filter
- IF statement not working – Any suggestions?
- Changing ALT-tag for logo in wordpress
- Fatal error: Uncaught Error: Class ‘WP_Block_Styles_Registry’
- using filter and hook inside class
- How to bind each “the_content” elements to a custom variables
- add_action in wp_head accessible from class
- Filter portforlio with librairie isotop
- add_filter() inside another add_filter()
- Redirecting the lost password page request when using a custon login page
- in the post admin, is it possible to make the post title input disabled using php?
- Use WP user status (logged_in) to manage access to independent application
- Custom Bulk Actions handler not firing
- WordPress load javascript file if something… (after the page is loaded)
- Serve cookie free URLs in WordPress without using a CDN
- dynamically change content of div with php
- How to include different html tags in the header for different pages?
- my site show this symbol (::) between site title and tagline
- How does add_action ‘comment_post’ work?
- Search box background on a different page template
- Changing 2011 theme header image based on user dropdown
- Warning: Cannot modify header information (with a twist)
- Cookie not created in AJAX request
- Keep users logged in Without Remember Me
- Dynamic Email Handler with ‘header (“Location: …’
- How to add different menu items on different menus?
- Custom Filtering date with newsletter