0
votes

I need to have permalink structure /blog/%postname%/ for SEO purposes ,it works but when i add a post without title its permalink generated with its post id. Eg: site.com/blog/124 where 124 is the post id. But when viewing the posts it lists all post in the page,even if i type it as 125(which is not in admin) it lists all posts in same page. On research found that wordpress takes 123 as paged variable that is why it uses the index.php page. Is it possible to solve this ? i need site.com/blog/124 as a valid post page and site.com/blog/any_other_number redirect to 404 page.

1
What happens if you set 124 as the title?ngearing
I don't need title,in my case there are some posts without title and with title. If i set 124 as title it will display in user sideSujeesh S
Yes thats what you want right? You want people to be able to goto 124 and for it to display? So if you set the title to 124 does that not work? Does that not make 124 a valid post url?ngearing

1 Answers

0
votes

So you want your url to look like /blog/%postname%/ but you don't want to have post title. But if you don't enter title then it won't show postname in url right but it become /blog/post-id-number instead.

You can achieve this by first publish the post with some actual title. Then wordpress will generate permalink to be /blog/%postname% and it will save into database.

Once you already publish the post, now edit the post and remove the title and then click save. Wordpress won't edit your permalink mean it will still be /blog/%the old postname% but now you will have empty post title.