Changing the View custom post type slug
By default, the plugin presents Views using the following url structure:
http://www.example.com/view/my-view-name/
If you'd like to change the part of the URL (known as a "slug") from view
to a different name, then add the following code to your theme's functions.php:
add_filter( 'gravityview_slug', 'my_gravityview_slug', 10, 1 );
function my_gravityview_slug( $slug ) {
return 'my-new-slug'; // Set your new slug here
}
If the code doesn't work immediately:
After adding this to your theme, you may need to flush the rewrite rules.
To flush the rewrite rules:
- Go to your site's WordPress Dashboard
- Click on the Settings menu
- Click on the Permalinks sub-menu link
- Save the form settings on that page (without changing anything)
- The rewrites should be updated, and the links should work!