halben Posted October 17, 2013 Share Posted October 17, 2013 Hi All, I'm trying to rename a category name from my url. Here it is: // Register custom post types add_action('init', 'pyre_init'); function pyre_init() { global $data; register_post_type( 'avada_portfolio', array( 'labels' => array( 'name' => 'Portfolio', 'singular_name' => 'Portfolio' ), 'public' => true, 'has_archive' => true, 'rewrite' => array('slug' => $data['portfolio_slug']), 'supports' => array('title', 'editor', 'thumbnail','comments'), 'can_export' => true, ) ); register_taxonomy('portfolio_category', 'avada_portfolio', array('hierarchical' => true, 'label' => 'Categories', 'query_var' => true, 'rewrite' => true)); register_taxonomy('portfolio_skills', 'avada_portfolio', array('hierarchical' => true, 'label' => 'Skills', 'query_var' => true, 'rewrite' => true)); ... Here is what I have at the moment: function custom_portfolio_to_customer_category_url($content) { $current_path = 'portfolio_category'; $new_path = 'customer_category'; $content = str_replace($current_path, $new_path, $content); return $content; } add_filter('term_link', 'custom_portfolio_to_customer_category_url'); I'm using the str_replace() function to rename portfolio_category to customer_category. "It" did replace it but it seems to have wiped out the category and I'm unable to access the portfolio_category post. Can someone please guide me or assist me in what I'm doing wrong here? Thank you, Hal Quote Link to comment https://forums.phpfreaks.com/topic/283072-rename-url-category-pathname/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.