CPT-onomies: Using Custom Post Types as Taxonomies
[resolved] Fix for CPT-onomy feeds and pagination (1 post)

  1. Rachel Carden
    Plugin Author

    Posted 2 years ago #

    Hey gang. If your CPT-onomy feeds or pagination isn't working, it's because they require custom rewrite rules and... well... honestly, I'm not really sure why this hasn't been fixed before now.

    I'm trying my best to get an update out soon but, in the meantime, here's the fix:

    Replace lines 860-868 of manager.php with the following code:

    // replace the variables ($post_type and $term)
    $cpt_onomy_archive_slug = str_replace( array( '$post_type', '$term_slug', '$term_id' ), array( $taxonomy, '([^/]+)', '([^/]+)' ), $cpt_onomy_archive_slug );
    // get rid of any slashes at the beginning AND end
    $cpt_onomy_archive_slug = preg_replace( '/^([\/]+)/', '', $cpt_onomy_archive_slug );
    $cpt_onomy_archive_slug = preg_replace( '/([\/]+)$/', '', $cpt_onomy_archive_slug );
    // add feeds rewrite
    add_rewrite_rule( $cpt_onomy_archive_slug . '/feed/(feed|rdf|rss|rss2|atom)/?$', 'index.php?'.$taxonomy . '=$matches[1]&feed=$matches[2]&cpt_onomy_archive=1', 'top' );
    add_rewrite_rule( $cpt_onomy_archive_slug . '/(feed|rdf|rss|rss2|atom)/?$', 'index.php?'.$taxonomy . '=$matches[1]&feed=$matches[2]&cpt_onomy_archive=1', 'top' );
    // adding pagination rewrite
    add_rewrite_rule( $cpt_onomy_archive_slug . '/page/?([0-9]{1,})/?$', 'index.php?'.$taxonomy . '=$matches[1]&paged=$matches[2]&cpt_onomy_archive=1', 'top' );
    // add base URL rewrite
    add_rewrite_rule( $cpt_onomy_archive_slug . '/?$', 'index.php?'.$taxonomy . '=$matches[1]&cpt_onomy_archive=1', 'top' );


Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic