is_page()
relies on a complete global $wp_query
object. If you call it before the action template_redirect
has been fired, it might be impossible to get that data.
Wait for a proper action.
Example:
add_filter( 'template_include', function( $template ) {
if ( is_page( 27 ) )
echo 'this is the apply page';
return $template;
});
You can call is_page()
in a loop too.
Related Posts:
- Show modified time if post is actually modified
- AJAX handler throws 400 (Bad request) – why?
- How to display the_post_thumbnail if a post has one or otherwise display the first image in a post?
- Most elegant way to enqueue scripts in function.php with foreach loop
- WordPress – thumbnail image from youtube (function and loop)
- Adding WooCommerce to a Custom Theme – not working [closed]
- A snippet after every image
- Function to show only first instance of shortcode
- Automatically insert php function into post $the_content
- Creating loop within functions.php
- Display WooCommerce subscriptions for user [closed]
- How to use max and min values of custom fields
- Custom Shortcode, functions PHP WP_Query loop
- Filtering posts by category name based on page’s slug
- 2 Loops, Only Displaying 1 Loop in Both Loops
- Having a Function Inside of the Loop
- Getting different functions data while using while loop in wordpress
- Create a new query in function.php to filter blog posts
- Limit length of first excerpt in the loop
- Default Custom Field Value Automatically Update
- Multiple Loops Meta Data
- The Loop not looping?
- While loop with an exception after a count is reached
- How do I pull excerpts from pages?
- Output loop to function return?
- issue with if/elseif in_array inside foreach loop display only one post
- Genesis Framework: How to exclude a specific author from archive custom loop
- Problem with calling custom function in a foreach loop
- Get term slug by term id and then explode it
- Using functions.php to include code that’s processed inline
- Breaking up multiple words and inserting an image after first word
- Simplest Way to Build Custom Archives Page?
- Woocommerce Variable Product Dropdown for Custom Shop Template
- the_date() and the_time() functions display actual date an time instead of published date and time
- How set a while with a function
- Pass post ID from archive template to functions file
- Prevent function from triggering on current page
- How to use `foreach()` in ajax call
- Code executes outside of Loop while same code gives ‘Uninitialized string offset’ notice inside a while loop
- Only seems to be displaying one child when there are supposed to be multiple
- Integrate WP Tiles into existing loop (index.php) and theme
- Check if excerpt is empty at loop-portfolio
- Function to get the name in database table from the comma separated string
- Way of getting queried loop before the query with a filter hook?
- Post variables not displaying correctly in custom function
- Why don’t some template tags work when querying information on single.php?
- how to handle multiple forloop?
- Parse error: syntax error, unexpected ‘endforeach’ (T_ENDFOREACH) in [closed]
- How do grab the main loop, with conditions, and output via shortcodes
- Creating mixture of shortcodes to use in the visual/text editor
- Get full slug for a WordPress Post
- Update post meta with wp cron
- How to check if a user exists by a given id
- TinyMCE custom styles remove class when switching styles
- Show/hide Widgets in Dashboard Based on Current Advanced Custom Fields Option
- syntax for remove_filter in parent theme with class
- How to Acheive the custom woocommerce category template
- Can I remove the Rich Text box editor for a specific post?
- How to update BuddyPress xprofile fields programmatically? [closed]
- Programmatically set page template based on page ID
- How can I add an image field to BuddyPress Extended Profile Fields? [closed]
- wp_remote_post with ssl:// protocol
- Best way to programatically add “rel” attributes to page and post images
- Override a theme function in a child theme?
- changing behaviour of get_search_form
- Include default functions and methods
- file_get_contents – failed to open stream
- wp_nonce_field is breaking form for reasons unknown
- How do I call a function to use on a page?
- Different favicon on different pages
- How do I display a date correctly that is stored in the database as a backwards 8 digit number from Advanced Custom Fields? [closed]
- dynamic enquiry form [closed]
- How would I make a function to dynamically determine if user is logged to change navigation menu text?
- How to redirect Subscribers on login to specific page, when logging in from a Page
- how can I add filter in specfic field in my website?
- Which filter fires upon setting a featured image
- How to customize archive widget only for cpt?
- some profile informations like youtube link doesnt seem
- How to modify or override a core function (wp_star_rating)
- Filter posts on new page
- Sticky – Featured Image
- WordPress Jquery+scripts enqueue issue
- Adding a jQuery rotator function
- How to pass a variable from a template page to the child theme functions.php
- Settings in functions.php used by a plugin
- Echo a div to header.php from functions.php
- Is mytheme_post_thumbnails() still necessary?
- My website is generating weired url parameters of paginated pages
- Whats the proper way to add a new user via a front end form?
- When the WP_EDITOR button is pressed, the user is prompted to select a photo from their device
- How to crop image in WordPress with aspect ratio for any size of image
- Bad value crossorigin for attribute crossorigin on element link
- Logout redirect via page template without confirmation?
- How can I modify or filter this variable in an existing class? (Mai Theme)
- Get category of post inside save_post hook
- Custom customizer CSS priority
- Custom HTML structure in customizer not rendring in Browser
- iOS and ajaxComplete
- Log in and out using custom pages, no logout confirmation and redirects for logging in and out 2023
- Copy and Modified WooCommerce function is_coupon_valid [closed]