John Davidson

Wordpress single-(posttype).php fehler

0 comments
Message:


I have a custom post type (projects) and a page-projects.php. Both of them work. I add a single-projects.php and if I go to a single post there comes the 404 page. In the backend if I add a new project-post I can see the preview. But if I save the post and go again to the preview there is the 404 page.


How can I fix this problem?


Ps. I think if i don't safe the post there is the post id in the link. If I save it the link is like the titel: projects/postname ...


Thanks for helping!!



My Answer:
It sounds like there may be an issue with the permalink structure for your custom post type. Here are a few steps you can take to try and fix the problem:

1. Go to Settings > Permalinks in your WordPress dashboard and click on the "Save Changes" button. This will refresh your permalink structure and may resolve the issue.

2. Make sure that your single-projects.php file is correctly named and located in your theme folder. It should be named single-projects.php and located in the root of your theme folder.

3. Check your custom post type registration code to ensure that the rewrite slug is set correctly. It should match the slug you are using in your permalink structure.

4. If you are using any custom rewrite rules in your functions.php file, make sure they are not conflicting with the permalink structure for your custom post type.

5. If none of the above steps work, try disabling any plugins that may be causing conflicts with your custom post type.

If you are still experiencing issues after trying these steps, you may need to troubleshoot further or seek help from a developer familiar with WordPress custom post types.

Rate this post

5 of 5 based on 3906 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us