Support » Fixing WordPress » Exclude category from feed plus force full content?

  • Resolved bmck


    My main feed includes all categories and is excerpt-only (in the spirit of RSS!). I’m trying to produce a feed for a specific syndication purpose, which needs my “asides” category (id=16) excluding and should be full content cf. excerpt-only.

    The first requirement, with help, I have address by editing index.php at root level to this:

    define('WP_USE_THEMES', true);
    if(isset($_GET['feed'])) {
    if(isset($_GET['type_of_feed'])) {
    if ($_GET['type_of_feed']=='9rules'){

    Is it possible to modify this to achieve the second requirement, to force this particular feed to contain the full post?

Viewing 12 replies - 1 through 12 (of 12 total)
  • Obviously a difficult question.

    Evidently extremely challenging. I’ll bet there isn’t a single WP user visiting these forums who is remotely capable of answering this one, with a simple “Yes” or “No, it isn’t possible”. Not the case? Prove me wrong!

    I’ve given up on changing index.php. I’ve reverted to the default. Here’s the current situation: will redirect correctly to FeedBurner (

    I want to re-direct to a custom feed that excludes posts in category 16.

    I added the following to my .htaccess file:

    # Test to show bookmarks only
    RewriteBase /
    RewriteRule ^9rules/feed/?$ /index.php?&feed=rss2&cat=16 [R,L]

    This will correctly show cat 16 (bookmarks) only for

    # Create a feed for excluding bookmarks
    RewriteBase /
    RewriteRule ^9rules/feed/?$ /index.php?&feed=rss2&cat=-16 [R,L]

    This should show posts in all categories *except* in cat 16.

    However, it results in this:

    WordPress database error: [Not unique table/alias: ‘wp_post2cat’]
    SELECT DISTINCT * FROM wp_posts LEFT JOIN wp_post2cat ON (wp_posts.ID = wp_post2cat.post_id) LEFT JOIN wp_post2cat ON (wp_posts.ID = wp_post2cat.post_id) WHERE 1=1 AND (category_id != 16) AND post_date_gmt <= ‘2006-07-20 10:10:59’ AND (post_status = “publish” OR post_author = 1 AND post_status != ‘draft’ AND post_status != ‘static’) AND post_status != “attachment” GROUP BY wp_posts.ID ORDER BY post_date DESC LIMIT 0, 10

    Warning: Cannot modify header information – headers already sent by (output started at /home/.ashea/bioneural/ in /home/.ashea/bioneural/ on line 8 stuff worth sharing Tue, 18 Jul 2006 21:09:04 +0000 en


    OK, so I’m told this rewrite hack worked in WP 1.x but broke in WP 2.x

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    I don’t think you’re on the wrong track here. I didn’t know that the -cat trick would work for feeds, but it does on my blog, so it should on yours too.

    Try this URL:

    If that doesn’t work, I suspect that your feed redirection to feedburner is the real problem here.

    Otto42 thanks, no, I already tried that URL and I get the same WP database error as above. You may be right about implicating the FeedBurner redirection (which I want to keep). In any case I have finally resolved this and now offer a excerpt-only feed for all categories, and a full-text feed excluding category 16 (bookmarks).

    Details here.



    This thread looks really promising, but I’m a little lost. I am trying to exclude 2 categories from my feed.

    Would I just write this to exclude the categories?

    Where exactly would I add that?,-14 as the URL might work. Maybe it depends on which version of WordPress you use. Maybe on whether your redirect to FeedBurner. Maybe on the phase of the Moon?



    Right, I could do that… but I want the default feed to omit these categories instead. I want people to visit directly and not find these 2 categories… is this possible? I don’t want people to have to add stuff to the end of the URL…

    Can you edit your .htaccess file? If so this might work:

    # Re-direct default feed to exclude cats 8 and 14
    RewriteBase /
    RewriteRule ^feed/?$ /index.php?&feed=rss2&cat=-8,-14 [R,L]

    So anyone who clicks on your default feed link ( should get re-directed to:,-14

    Please let me know if this does work. If so, then the reason it does NOT work for me must be to do with my FeedBurner re-direction.

    For future reference, I was able to exclude a category while still using FeedBurner. I just edited the FeedBurner source feed to be:

    (where N is the category number to exclude)

    It’s looking good so far. If I run into any problems, I’ll post back here.

    I’m trying to do this same thing. Did the final solution work?

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Exclude category from feed plus force full content?’ is closed to new replies.