-1

Where I Place This Code Or How Can I Use This?

function wpa_alter_cat_links( $termlink, $term, $taxonomy ){
    if( 'category' != $taxonomy ) return $termlink;

    return str_replace( '/category', '', $termlink );
}
add_filter( 'term_link', 'wpa_alter_cat_links', 10, 3 );

You'll probably want to test this thoroughly for any side-effects, use at your own risk!

EDIT - altering just top level category links:

function wpa_alter_cat_links( $termlink, $term, $taxonomy ){
    if( 'category' == $taxonomy && 0 == $term->parent ){
        return str_replace( '/category', '', $termlink );
    }
    return $termlink;
}
add_filter( 'term_link', 'wpa_alter_cat_links', 10, 3 );

Original Source: Force Wordpress to Show Pages Instead of Category

1
  • Please don't ask for help in your title. The post title should be a smart short description of what your question is all about. Thank you Feb 3, 2015 at 6:47

1 Answer 1

0

You would place this code inside your theme's functions.php file. It shouldn't really matter where in the file that you place it.

1
  • not working On theme's functions.php
    – Jai
    Feb 4, 2015 at 4:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.