• Hi there,

    I have set up a seemingly simple ‘post_limits’ filter to modify a single post_type and category’s RSS feed to display 200 items. This is so I can consume the feed on another site and to have more than the default 20 items – these are events from “The Event Calendar” plugin.

    When I implement the code below on the parent site, the WordPress media library on the site fails to load. It is as if it is loading 200 items as well. When I remove the filter, the media library works correctly, and loads pages of 40 items.

    Here is the code causing the issue. Could you please let me know if you see any problems with the filter?

    function coh_custom_rss_page_size(){
    	if( ! is_admin() && is_feed( 'tribe_events' ) && is_category( 'community' ) ) {
    		return 'LIMIT 0, 200';
        }
    }
    add_filter( 'post_limits', 'coh_custom_rss_page_size' );
Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    What if you add one of the ‘attachment’ conditionals to the 2nd line?

    https://codex.www.ads-software.com/Conditional_Tags

    Thread Starter stevensjn

    (@stevensjn)

    function coh_custom_rss_page_size(){
    	if( ! is_attachment() && is_feed( 'tribe_events' ) && is_category( 'community' ) ) {
    		return 'LIMIT 0, 200';
        }
    }
    add_filter( 'post_limits', 'coh_custom_rss_page_size' );

    This code returns the same outcome. :/

    I’ve just ported my production site/data back to my development environment and disabled all plugins, and switched to “twentyseventeen”, but there is no change in the media library loading… same javascript unresponsive issue after 20-30 seconds using the above code.

    Egads.

    • This reply was modified 7 years, 5 months ago by stevensjn. Reason: (more info added)
    Moderator bcworkz

    (@bcworkz)

    You need to collect the passed limit clause in your function declaration and return it unchanged when returning LIMIT 0, 200 is not appropriate.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘‘post_limits’ Filter Breaking Meda Library?’ is closed to new replies.