0

I have custom post types setup such that the items don't have or need single-post pages. The posts will be displayed via a custom query on a page.

My question is when i create a single post (on the custom post type), how do i redirect the preview link so it previews the page and not the single-post?

the only way i can think of is make the single-[posttype].php template identical in template and query with the archive page i made, but that just seems wonky.

0

Asking this question gave me an idea. make the single-[posttype].php and inside it just put

<?php wp_redirect(get_page_uri(get_page_by_path('your-page-slug')); ?>

also works with get_page_by_title()

This will direct the preview post and view post link on the admin create post page to the page you want.

| improve this answer | |
0

If you post type isn't public (doesn't have single view ) or archive (just because you use a custom query) why just not set it as non public?

See register_post_type function parameters - specially public element ?

| improve this answer | |
  • if i set it to non-public, will my single-custompost.php template work? if it doesnt then my problem remains, how do i direct the preview link to the archive page? – George Ananda Eman Jul 18 '14 at 15:23
  • if you use a custom query to retrive data from db - yes. – Oleg Butuzov Jul 19 '14 at 6:47
  • Tried it, it leaves out the option to preview the post (in the archive page) entirely, which is the goal of my question. But i must say leaving it out entirely just might be another solution to my clients getting confused when making posts and previewing them. – George Ananda Eman Jul 19 '14 at 8:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.