You have not specified exactly when your code runs but you can hook into “request” to check the requested page:
add_filter( 'request', function( $request ){
if( isset( $request['feed'] ) ){
//This is a feed request
}
return $request;
});
When the requested page is a feed $request
, which is an array of query variables, will contain an item called “feed” which is set with the name of the feed like “rss” for example.
https://codex.wordpress.org/Plugin_API/Filter_Reference/request
Related Posts:
- How to check if the current page is at a specified path in the URL?
- How to get URL of current page displayed?
- Sending the reset password link programatically
- Getting only direct child pages in WordPress with get_pages
- Populate editor with some content of a page with a page template
- Extend PHP regex to cover “srcset” and “style” attributes
- How can I add an area/option for a custom page description?
- Create Page To Count Comments For Each Post In WordPress Site
- My php header() function is not working [closed]
- Scrape external webpage for first image and add it to new post
- Create custom permalinks to show Custom Post Type’s relationship?
- Search Query: how to construct a search string from two select elements?
- Get URL Parameters from referer
- Need help enqueueing webfonts
- get_the_title() gets printed out twice
- How do I find PHP file that contains content of my page?
- WordPress page content outside WordPress
- Using the_excerpt() on a page
- Inject class in body when particular page template is used
- Use .php file as page instead of wordpress page & template file?
- Use WordPress function in php file
- Why is $wp->request empty in WordPress 6.0?
- Why am I getting a different filename? And how does WordPress load singular.php for both Page & Post? (Fresh WordPress installation)
- Get the URL of the page from which an ajax request has been launched within ajax callback
- Show About and Contact Us page when they’re clicked in the top menu.
- Parsing Menu Items and Blog Posts
- How to use theme function in post/page?
- How to pass a PHP $_GET variable and fetch/output it?
- My php code is not being executed
- How to modify the default feed via a function
- Post’s ID pattern?
- trouble with page_id & highlighting current page
- Apply class to every third list item? [duplicate]
- How to include custom code on a page that’s set to act as homepage?
- Can a page contain php code?
- What’s the best way to include PHP code in pages?
- Automatically add images to a menu
- page-slug.php not working but only for specific slug
- Need php code’s output to display underneath a Divi Module
- Insert page content into another page with a changed variable
- Can I add the post featured image to a specific RSS feed?
- How to echo every parent page title?
- How Do I Find & Remove H1 From Site-Title-Wrapper? [closed]
- I’m unable to call img path using single quotes in an array?
- Need to Modify a WordPress Shortcode with another wordpress shortcode
- Retrieve Json data and create multiple pages with it
- How to add page numbering with php?
- Display child page content of a specific parent on home page
- change default RSS feed URL
- How do i add slugs to a URL, but still redirecting to the same page
- Noindex subscriber author page
- Can’t change website Title on wordpress
- Nginx WordPress and another Web app URL structure
- Removing custom sort order from admin page listing
- PHP Output also in Child theme, but different
- How to use title attributes in sidebar widget?
- how to get attached file url for current post?
- $wpdb->get_results breaking page?
- Unique PHP on each Page
- How to Display a List of Child Pages For a Parent Page in WordPress
- Call featured image url
- Creating customized php files in theme folder
- If is page, archive or search output this code
- WordPress Search
- List all anchor links on a page
- How do I include an external PHP file in a subdir WordPress install?
- How to add PHP pagination to wordpress
- Use an anchor link to open an iframe inside a WordPress page
- Toolbar Hidden in a Virtual Page
- Adding custom url to readmore link using get_permalink()
- How to set base url for php widget
- Comment_author_url doing nothing
- Aspx/Rss feed – failed to open stream: Redirection limit reached
- How do I add my PHP app to a WordPress page whilst keeping semantic URLs?
- Modifying WP URL handing code?
- Page load timer?
- How to deal with a GET variable of ‘name’?
- WordPress permalink issue
- WordPress is removing query variables like page, p from the URL of a custom static page
- Workaround for og:image unsupported webp image type, Yoast SEO?
- How to define a rule in functions.php that ONLY disables the default wp functionality that undesirably changes ‘&’ to ‘#038;’?
- Page not visible in ‘All pages’ after being added through PHP
- Cascading dropdown select search based on Parent Page & Child Page
- Edit and delete permissions pages and posts
- My worpress search page is showing no results
- A function to get the content of a page
- Unable to display multiple parameters from url by javascript through shortcodes
- Allow two posts (from different categories) to have the same slug
- Prepend to all image URLs with PHP, only for mobile devices
- Get nice name of category from slug (remove dashes of category)
- WordPress create custom XML RSS feed template
- how can i redirect dynamic URL in worpress base on ID in htaccess or wp-config or function.php
- How can I check if a post with a particular slug or title exists?
- When I click for the redirect link it is showing the content of index.php instead of single_assignment_page.php
- Add Link to PHP message
- Category Page Displaying all Pages
- Current WordPress Page Title as Search Parameter into A Tag
- Remove all feeds and return custom 404 page
- Rewrite rule not working, but only when parameter is text
- Split post or page content in two or more columns