Skip to content

Instantly share code, notes, and snippets.

@cre8tivediva
Last active October 13, 2021 06:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save cre8tivediva/ebad9d4d34120368d9e89a09821b0596 to your computer and use it in GitHub Desktop.
Save cre8tivediva/ebad9d4d34120368d9e89a09821b0596 to your computer and use it in GitHub Desktop.
Rename the Genesis Portfolio Slug
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
/**
* 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' );
if (!isset($args->name)) return;
$args->rewrite['slug'] = 'your-new-slug';
register_post_type( $args->name, $args );
}
add_action( 'init', 'rename_portfolio_custom_post_type_slug', 5 );
@tony1357
Copy link

tony1357 commented Feb 24, 2019

Thanks for the code, when I visit new permarklink, it works but the single porfolio post still display /porfolio/post/

The code does not change for single porfolio post, you can see at here https://www.canthoweb.com/dich-vu/

Please fix if possible

@BiancaNL
Copy link

Hi Anita, thanks for this snippet. I forked and adjusted the code a bit to make it work with the Genesis Pro Portfolio.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment