contacts

Get All 146 Premium WordPress Themes for Just $59.99
One-Time Payment: Unlimited Use Across Unlimited Domains, Plus Free Lifetime Updates! Learn more

How to Change ‘project’ Slug Name

How to Change ‘project’ Slug Name

We include Projects as a custom post type in many of our WordPress themes. It is a useful custom type of data which allows you to organize your website content and display it as a block and single projects page.

In some cases you may want to rename the ‘projects’ slug (the part ‘projects’ in single projects URL i.e. https://yoursite.com/projects/some-project-name/) it to another word. It will require some code changes. Here are all of the necessary steps:

1.Login to your Admin Panel

2. Navigate to Left Menu -> Appearance -> Theme Editor

3. Open functions.php

4. Rename the following occurrences of ‘project’ to ‘your_new_name’:

register_post_type( 'project', $args );
$data = get_post_meta($post->ID, 'project', true);
if ( 'project' != get_post_type( $post_id ) )
update_post_meta( $post_id, 'project', $data );
add_meta_box( 'project_metabox', 'Class Information', 'tishonator_add_class_fields', 'class' );
if ($post_type == 'project') {

5. The same rename of ‘class’ needs to be applied in file inc/blocks.php

$projectsArgs = array( 'post_type' => 'project', 'posts_per_page' => $count);
$data = get_post_meta( $r->post->ID, 'project', true );

6. And the same rename of ‘project’ needs to be applied in file single-project.php

$data = get_post_meta( get_the_ID(), 'class', true );

8. Also, you need to connect via FTP to your site /public_html/yoursite/wp-content/themes/yourtheme and rename file: single-project.php to your single-yournewname.php

Please Note: After the above change, all of the existing Projects in Admin Panel -> Left Menu -> Projects will disappear and they needs to be recreated again.