How to Change WordPress Post labels to Projects
|
/ Documentation /Custom Code Snippets/ How to Change WordPress Post labels to Projects

How to Change WordPress Post labels to Projects

In WordPress, you can easily change the labels used for the “Post” post type to something more suitable for your website, such as “Projects”. This can be accomplished by adding a snippet of code to your child theme’s functions.php file.

In this document, we’ll guide you through the process of how to change WordPress Post labels to Projects with a simple code snippet.

How to Change WordPress Post labels to Projects

Here’s a quick and easy guide to get you started.

  • Log in to your WordPress admin panel using your credentials.
  • In the WordPress dashboard, go to “Appearance” and select “Theme File Editor.”
  • In the Theme Editor, you should see a list of theme files on the right. Locate and select the `functions.php` file from the list.
  • Inside the `functions.php` file, you can add the following code snippet:
function astra_change_post_object() {
    $get_post_type = get_post_type_object('post');
    $labels = $get_post_type->labels;
    $labels->name = 'Projects';
    $labels->singular_name = 'Projects';
    $labels->add_new = 'Add Projects';
    $labels->add_new_item = 'Add Projects';
    $labels->edit_item = 'Edit Projects';
    $labels->new_item = 'Projects';
    $labels->view_item = 'View Projects';
    $labels->search_items = 'Search Projects';
    $labels->not_found = 'No Projects found';
    $labels->not_found_in_trash = 'No Projects found in Trash';
    $labels->all_items = 'All Projects';
    $labels->menu_name = 'Projects';
    $labels->name_admin_bar = 'Projects';
}

add_action( 'init', 'astra_change_post_object' );

This code snippet utilizes the astra_change_post_object function to modify the labels of the “post” post type to “Projects”. Feel free to modify the labels based on your preferences by updating the corresponding values.

  • After making the necessary changes to the functions.php file, save the file. Then, upload the modified functions.php file to your child theme’s directory, replacing the existing file if prompted.

To verify the changes, visit the WordPress admin area and navigate to the “Posts” section. You should see that the post labels have been updated to “Projects” or whatever labels you have specified in the code. The changes will be reflected in the post listing, post editor, and any other relevant areas.

Note: Remember to make any changes to your theme’s files with caution, and always keep a backup of your site in case anything goes wrong. If you have any questions or need further assistance, leave a comment below.

Was this doc helpful?
What went wrong?

We don't respond to the article feedback, we use it to improve our support content.

Need help? Contact Support
On this page

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.

This field is required.

REWIND

YEAR IN REVIEW

Scroll to Top
Now choose your preferred
page builder addon
Choose your preferred page builder addon

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.

Download Free Astra Theme - Modal Popup Form