Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Aurelian Spodarec
Aurelian Spodarec
10,801 Points

Permalink not working correclty

HI,

So, I have set my permalinks on post name, and when I click my page-articles, my article, it should go to page-articles, but in the url it shows me

http://localhost/aureblog/articles/26/

And I mean, htat 26, should it the post name. I tried to chagne all of that, it had like no effect.

Thats my code in WP

add_action( 'init', 'create_post_type' );
function create_post_type() {
  register_post_type( 'Articles',
    array(
      'labels' => array(
        'name' => __( 'Articles' ),
        'singular_name' => __( 'Article' )
      ),
      'public' => true,
      'has_archive' => true,
    )
  );
}

or

function create_posttype() {
    register_post_type( 'Articles',
        array(
            'labels' => array(
                'name' => __( 'Articles' ),
                'singular_name' => __( 'Article' )
            ),
            'public' => true,
            'has_archive' => true,
            'rewrite' => array('slug' => 'articles'),
        )
    );
}
add_action( 'init', 'create_posttype' );

I'm using ACF, what shall I do?

1 Answer

Lucas Santos
Lucas Santos
19,315 Points

I believe you have to go within your Wordpress Settings and change your Permalink Settings.