We're creating a WordPress website that uses custom posts and custom fields. We're using the "Custom Post Type Permalinks" plugin for our links and "Custom Post Type UI" for our posts.
Our current links are like:
http://example.com/<custom post type>/<custom taxonomy>/<custom post slug>
Example:
http://example.com/my-custom-post/my-custom-taxonomy/my-post-slug
What we're trying to achieve is:
http://example.com/<custom taxonomy>/<custom post slug>
Example:
http://example.com/my-custom-taxonomy/my-post-slug
Although it is achievable by setting the custom post values to the following:
Rewrite: True
Custom Rewrite Slug: %my-custom-taxonomy%
With Front: False
But when I do that the link goes to a 404 page. It seems that WordPress cannot find the post or recognize the custom post.
We already did the flush_rewrite_rules() but the problem stays the same.
How can I make the link open the requested post?
Related
I'm a newbie to the Wordpress.
So far I have a custom post type called 'property'. This post type has one custom field called 'property_city'.
In WP-admin - permalink setting, I have selected Post name option. So, posts of this custom post type have URLs like:
http://xxx.local/properties/edge-apartments/
http://xxx.local/properties/northgate-point/
What I want to have those URL to be generated using the city of the property and also I want to change properties prefix with student-properties like that:
http://xxx.local/student-properties/Manchester/edge-apartments/
http://xxx.local/student-properties/Chester/northgate-point/
I have tried various plugin and various code, but none of them worked as expected.
Any help would be appreciated.
Thanks,
try Permalink manager plugin it works for me here is the link : https://wordpress.org/plugins/permalink-manager/
I am currently working on a blog section of a website that's powered by wordpress.
Currently post are defaulted to /blog/$postname%
however we have a select few post that do not need to be /blog/ they should be /news/%postname%
is it possible to do this in WP?
Also if it helps I am using CPT UI to make a custom post.
You can't change the base url for just a few posts but you can create a separate post type for the ones you want to be different. Using CPTUI you can set their base to be /news. In the CPTUI admin just set "Has Archive" to true and putting "news" in the input for the slug to use.
I have following structure in my website:
I have a post type called Destination and slug of post type is "destination".
So I can access destinations archive page using following url: domain.com/destination.
Now the default blog posts are related to a single destination. For example i have a blog post called places to visit in london. So I have to relate this post to london destination. Which I am storing in my post meta.
Which is easy and I have done it.
But the problem is I need permalink structure in following way.
Destination archive page: domain.com/destination
Single blog page: domain.com/destination/london/blog/places-to-visit-in-london.
I have used WP rewrite API for this. I have followed this artical from tuts plus.
You can find my code on pastbin:
http://pastebin.com/g74zZYUk
I have simply created two tags (%destination_cpt% and %destination_name% )
And those tags works fine and post links works like it should.
But when I open the blog post in frontend it gives me 404 error:
domain.com/destination/london/blog/places-to-visit-in-london
Due to destination slug exists as a post type.
If we use destinationsxyz as a first slug for default blog post, then default blog post and destination archive page archive page works fine.
But then if we write any first or second or third level wrong url like domain.com/abc or domain.com/abc/xyz or domain.com/abc/pqr/xyz then it leads to default blog page (which we set in settings->reading) of site but actually it should lead to 404 page and now only and only if you use wrong url having 4 levels like domain.com/des/abc/xyz/pqr/efg, it will lead to 404 page.
This happens in default WorrdPress installation with default WP theme (twentysixteen) with no plugin installed or no other extra piece of code theme.
Any help is appreciated.
Thanks in advance.
I've a custom post type that it can view on mywebsite.com/custom_post_type/ (with archive.php), but I don't understand how change permalink of "post" (default type - articles).
This is what I need:
I want to read all "post" with this url: mywebsite.com/news/. "News" would the slug for "post" type.
I think it's necessary to rewrite the permalink, but I didn't found anything on google.
Can you help me?
Thanks
I'm not 100% sure I understand your questions but I think you are trying to do is view all 'Posts' under mywebsite.com/news/ - In that case simply create a page called News (with the slug/permalink as news) and then in Settings > Reading - set the Front page to 'A static page', with the front page selecting your 'Home' page and the Posts page set as 'News' (the page you just made).
If you are talking about viewing all posts of a custom post type under news, either name the post type slug (under your rewrite array setting when you register the CPT) as News.
When creating a custom post type and fill it with some posts wordpress generates a page for that custom post type.
But I want to be able to add content to that page so I create a regular page and choose a template where I manually call the custom post type posts and loop them out. And now I can just add content in the wysiwyg editor. But this causes a conflict between these two pages, especially if the CPT has the same name as the page.
And now the question: Is there a way to always show the page where I have chosen the template for the CPT to always show? Even when someone try's to manually enter the url for the CPT generated page?
Here is what I understood from your question. You have custom post type. Then you created a page-template, that loops through your custom post types and output them. Now when you create a new page and assign it the page-template you have created you run into problems, if it has the same name as the custom post type.
Solution: I think what you need to do is change the custom-page slug from the admin menu. Then you would be able to directly reference it by the URL.