The file where the pre_get_posts
action runs is wp-includes/query.php
, If we look in that file, we’ll see that after the action is executed, the posts_per_page
setting is overridden for feeds with this bit of code:
if ( $this->is_feed ) {
$q['posts_per_page'] = get_option('posts_per_rss');
$q['nopaging'] = false;
}
In this case, we can add a filter to the value of posts_per_rss
to customize the feed quantity that way.
function feed_action( $query ){
if( $query->is_feed( 'podcast' ) ) {
add_filter( 'option_posts_per_rss', 'feed_posts' );
}
}
add_action( 'pre_get_posts', 'feed_action' );
function feed_posts(){
return 99;
}
Related Posts:
- Add Custom Fields to Custom Post Type RSS
- How to Make a Separate RSS Feed for Each Custom Post Type
- Rewrite custom post type rss feed links
- How can I generate a RSS feed based on a custom WP_Query?
- feed links for custom post type pages
- Custom post types – RSS lastBuildDate issue
- How to remove CPT comment feed from head?
- disable /feed/ for custom post type
- Add Taxonomy Values Within a Custom Post Type RSS Feed
- Adding posts of custom type into the main feed
- register_post_type – rewrite / feeds, what’s it for?
- How can we disable a custom post type archive page but enable its feed?
- Disable feeds for specific custom post types
- How to make custom post type feed title = taxonomies?
- Include only recents custom posts in WP rss feed
- Custom taxonomy in custom post RSS feed
- How to use has_archive but disable feed per post type?
- Display custom fields from custom posts in RSS feed
- What is best way to prevent access to Custom Post Types unless authenticated when the post type has an archive and is publicly queryable?
- Is it possible to have a custom post type with feed but without the archive?
- How can I show 1 featured post in a styled element, and the next few below differently styled
- 404 in custom post type feed with mistake permalink
- Custom rewrite to fetch feed data
- Creating separate feeds for custom post types
- How to fetch custom post types with its full data on wordpress?
- wp-includes does not contain a feed template
- wp3 custom post types rss
- Disable permalinks, but allow RSS feeds
- WordPress feed only shows first page of category
- Get link for feed of specific post type AND taxonomy
- Changing the RSS feed titles not working
- display posts, pages and custom post types from another wordpress site
- How to disable generation of default image sizes for some custom post types?
- Development of a WordPress Search Plugin – Best Practices
- Mini-Site Strategy
- How To Remove These Stuffs From Custom Post Type List Screen?
- Exclude a category from WP_Query
- How do I Filter Custom Post Type by Custom Taxonomy in the newest WordPress RESTful API?
- Setting up custom post type archives in WP3.1? Any luck?
- show tags of custom post type ONLY
- Hierachical Custom post types permalinks not working
- TV Show database – Best way for structuring it?
- Query posts by custom post type and custom taxonomy
- Query for posts from any post type but only add instock products
- WP insert post PHP function dynamically generated Custom Fields
- Query not returning CPT posts
- Change Post Title Edit Box
- How to keep a check box in custom meta box for custom post type checked by default for add new post?
- After deleting a post are terms, and custom meta deleted?
- Check Title Unique Or Not and If not error message and dont save
- 1 day after custom date change post status to draft
- Menu Multiple Taxonomies
- remove child post from custom post type archive
- Query that joins the postmeta table twice
- Multiple content sections on a custom post
- Unable to get paginate_links working with a custom query [duplicate]
- Different permalink for CPT and regular Posts/Pages but why?
- Open div inside a custom post-type with Fancybox
- Save metadata as a timestamp, display as a “pretty” date
- Can I search only some of the fields of a custom post type?
- Save the post parent in a custom post type in Gutenberg
- Dynamic template for single custom post
- Create another comment system for CPT
- Using a custom post type for an RSS feed only
- menu link to custom post_type?
- Custom permalink with child taxonomy terms
- Custom Taxonomy Not Showing in Front-End When Outputting a Custom Post Type with WP_Query()
- Custom post type archive with page as parent url
- Adding custom field values to wp_list_pages
- Custom columns doesn’t appear in custom post type
- How to insert data into meta box from another plugin?
- CPT Taxonomy As Archive Page – Error 404
- Use post in multiple places on a page with multiple posts
- unapprove comments on custom post type
- Can’t pull posts of a Custom Post Type based on the custom taxonomy of the CPT
- Custom post type pagination error
- Publish box in CPT remove ‘edit’ link
- Custom taxonomy permalink without term, redirection to CPT slug
- How do I troubleshoot pre_get_posts with Debug Bar?
- WP_query has incorrect wp_posts.post_name = ‘asc’ when I have custom post type called ‘order’
- How to only get the content of post page while looping?
- How to add badge “new” to the post title which are showed in recent post widgets in wordpress
- edit.php all post not working
- Delete Custom Posts & Attachments
- Parent child relation between Post and Page
- How to save post title before publish?
- WooThemes – Vendors / Bookings – Allow Vendors to manage resources
- URL with Hierarchical Taxonomies and same slug for all terms and sub-terms
- Custom post type archive page not showing on archive-posttype.php
- Implement post status update as frontend news announcement
- WP Query with multiple post types ordered by custom meta date then published date
- Expandable WordPress content (text) inside a post
- Custom Post Types and rewrite rules – One CPT works and a cloned one doesn’t
- Sort a custom post type loop by a custom taxomomy instead of chronologically
- Add custom taxonomies as class names to an archive page of custom post types
- WordPress URL Problems and Layout
- Querying meta values within an array
- Show posts of parent in edit.php
- How to add custom column to Custom post page list?
- Rewriting hierarchical post type