from How can I change HTTP headers only to posts of a specific category from a plugin:
add_action( 'template_redirect', 'update_header_cache' );
function update_header_cache() {
if( is_single( 1234) ) {
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
header('Pragma: no-cache');
header('Expires: Thu, 01 Dec 1990 16:00:00 GMT');
}
}
Related Posts:
- wp_headers vs send_headers. When to use each?
- How do I use the ‘http_request_host_is_external’ filter
- How to remove X-Frame-Options: SAMEORIGIN” from WordPress?
- No ‘Access-Control-Allow-Origin’ header is present [closed]
- How to properly modify WP Vary or any existing headers?
- How would I use a filter to remove header banner on certain post types
- How to remove a filter that is an anonymous object?
- How to add defer=”defer” tag in plugin javascripts?
- How do filters and hooks really work in PHP
- Trouble understanding apply_filters()
- How would one modify the filtering Gutenberg applies to pasted content?
- Gutenberg: Is there a way to know if current block is inside InnerBlocks?
- How to reorder billing fields in WooCommerce Checkout template? [closed]
- No filter of code on switch from html to visual editor, how?
- How to modify posts_where filter only for the search query
- How to wrap oEmbed-embedded video in DIV tags inside the_content?
- How to add filter with 2 args?
- WordPress Internal @ Mentions
- Is it possible to use object in add_action?
- Changing text within the Block Editor
- Add Class to Specific Paragraph of the_content()
- apply_filters() slices away needed arguments
- Search content for shortcodes and get parameters
- How to override the email function by using filters? [closed]
- Remove WPML’s home_url filter
- If Modified Since HTTP Header
- Apply the_title filter to post titles AND backend auto social-sharing plugin, but not nav menu
- How to hook some Unicode texts into calendar widget safely?
- How to add attributes to tag when template cannot be directly modified
- Edit pagination text in the get_the_posts_pagination function
- How does WordPress call functions attached to a certain action hook before calling functions attached to other hooks
- How to get current action?
- How to check if “media_send_to_editor” is audio?
- how to change appearence of the content of default post list columns?
- Use safety filters even if after applied intval?
- Modify site URL via functions.php of a theme
- When adding buttons to the tinyMCE editor, how do I make them wrap to the next line and/or display in the “Kitchen Sink” area?
- How to change the order (priority) of registered filters (or actions) (e.g. for the_content)?
- How to change the order of HTML output of a core block?
- How to add ‘total’ value to custom column title on the posts list page
- Is it possible to use multiple spaces in title?
- Create Page Template by hook programatically in Functions.php in WP 5.8.1
- Filter out comments with certain meta key/s in the admin backend
- HTML and custom field variable, inside variable
- WordPress custom admin notice still displays after wp_insert_post_data validation
- Why doesn’t remove_action work in my plugin?
- Using a filter to modify Genesis wp_nav_menu
- Filters on Login Page
- the_excerpt filter doesn’t work as expected
- How to filter link?
- What is the earliest hook to modify post content?
- How to modify only part of a function through the filter
- Something is filtering my shortcodes… Can’t figure out what
- How can I apply filters in my class that extends Walker_Nav_Menu?
- How should I be using filters and is_single together?
- Remove actions/filters that are set with create_function()
- How to edit embed filter for youtube video to allow responsive full width layout
- Remove get_template_part() from custom theme
- How to access page variable inside action hook
- Shorten the title length
- Hook in a sidebar widget and add some markup
- preg_match() not working with post content
- Search a title word through query_posts (not the exact match)
- return get_the_tag_list with whitespace removed
- Elementor Image Hover + Filter Grid [closed]
- ‘manage_users_custom_column’ is a filter, but ‘manage_posts_custom_column’ is an action. Why?
- comment_notification_text filter not working
- Line Breaks are stripped off when direction property is found
- Scanning for custom embed and prefetching
- Modify author url display in edit-comments.php
- WordPress remove_filter not working
- How to exclude or include categories in wp rest API without query parameters?
- Remove and replace woocommerce add to cart button [closed]
- Filter Post Title without affecting screen-reader-text
- Hook to change the site URL
- Replace a specific URL on all apperances on the Website (Maybe a filter?)
- Strange behaviour of REGEX in a WordPress filter (trying to suppress emtpy paragraphs)
- Modify Contextual Help
- Widget image reorganize layout
- WordPress set featured image to first image of the post
- Modify WordPress search behaviour in backend?
- Re-order search results with posts_orderby filter and post meta value
- Modify category listing API response
- How to remove the post pagination (Next page tag) depending on type of traffic source: from utm_campain or non-utm_campain
- add_filter not working inside if function
- How do I disable the warning “The backup of this post in your browser is different from the version below”?
- Change url to posts if they have custom tax only
- How to get to the date of the uploaded file
- How to filter posts in admin by before date or by post status ‘future’?
- Can’t get content of all (19) posts – Incomplete Chunked Encoding
- Customize register form page with add_action or apply_filter
- Override typo in multiple parent theme files?
- WooCommerce comments_template Filter Not Firing
- Woocommerce: Only one review per verified buyer [closed]
- Footnotes with dynamic title attributes?
- Can you call a filter hook by “add_action”?
- Filter widget_pages_args not working in Pages Widget
- How do I query Pending posts?
- Load More : Admin Ajax 400 Bad request, returning 0
- How to add placeholder into comment form textarea?