Changing url slug from /blog to /news

Hi talented wmpudevvers

If anyone could assist me with a query I would be most grateful.

I am looking to change the /blog slug on my URL to /news as I use the blogging/posting feature as a news feed. Is there a quick way to amend this without negatively affecting anything?
So from http://www.site.com/blog to http://www.site.com/news - is this easy enough to do?

Thanks for any help and apologies if it is an obvious question. The best I can find on google is amending the functions.php file but I was hoping for some wpmudev advice before I meddle.

Thanks in advance for your time.

  • Jude

    Howdy @@Tom

    Hope you are keeping well !

    Yeah .. this looks pretty straight forward to do, the method of using the fuctions.php for redirects should do the trick. Just make sure you set 301 to be the status code when adding the redirect rule.

    Alternately you can use .htaccess as shown here.

    http://www.inmotionhosting.com/support/website/redirects/setting-up-a-301-permanent-redirect-via-htaccess

    Cheers
    Jude

  • Tom

    Ahoy there Jude

    Thanks for your reply. I will follow one of the guides I have found on google then. Namely this, in the functions.php:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    function revcon_change_post_label() {
    global $menu;
    global $submenu;
    $menu[5][0] = 'News';
    $submenu['edit.php'][5][0] = 'News';
    $submenu['edit.php'][10][0] = 'Add News';
    $submenu['edit.php'][16][0] = 'News Tags';
    echo '';
    }
    function revcon_change_post_object() {
    global $wp_post_types;
    $labels = &$wp_post_types['post']->labels;
    $labels->name = 'News';
    $labels->singular_name = 'News';
    $labels->add_new = 'Add News';
    $labels->add_new_item = 'Add News';
    $labels->edit_item = 'Edit News';
    $labels->new_item = 'News';
    $labels->view_item = 'View News';
    $labels->search_items = 'Search News';
    $labels->not_found = 'No News found';
    $labels->not_found_in_trash = 'No News found in Trash';
    $labels->all_items = 'All News';
    $labels->menu_name = 'News';
    $labels->name_admin_bar = 'News';
    }

    add_action( 'admin_menu', 'revcon_change_post_label' );
    add_action( 'init', 'revcon_change_post_object' );

    Though there's a post on stackoverflow highlighting a better way with 'Custom Post Types'.
    See: http://stackoverflow.com/questions/23647142/wordpress-blog-url-changes-to-news
    A better approach?

    Thanks for your help so far! I find this a great resource because of you kind people. Have a smilie :slight_smile:

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.