
This past Monday a member of our Genesis Slack group asked a question, “Has anyone been able to successfully change the slug on Genesis Portfolio Pro plugin?” It was a little late but I was online.
I did some searching and came across two discussions on the web. The following code was “inspired by” this post on WordPress.org and this one on StackExchange which were the first two that showed up in my search results.
After reviewing the conversations, I fired up a demo. I then combined the suggestions and re-wrote the following which works perfectly.
Procedure
Just add this to your functions.php file. On line 13, change “your-new-name” to whatever slug you’d like, for example, “showcase”.
<?php | |
//* Do NOT include the opening php tag shown above. Copy the code shown below. | |
add_action( 'init', 'rename_portfolio_custom_post_type_slug', 5 ); | |
/** | |
* Rename slug in Genesis Portfolio Plugin. | |
* | |
* @author Anita Carter | |
* @link https://cre8tivediva.com/rename-genesis-portfolio-slug | |
*/ | |
function rename_portfolio_custom_post_type_slug() { | |
$args = get_post_type_object( 'portfolio' ); | |
$args->rewrite['slug'] = 'your-new-name'; | |
register_post_type( $args->name, $args ); | |
} |
That’s it!