I found solution: IF you’re using permalinks you have to use get_permalink() function:
<?php $searchresults = site_url('/?p=1365'); ?>
change to
<?php $searchresults = get_permalink( 1365 ); ?>
Related Posts:
- 404 Error on form submission within custom post type
- Direct form to a custom page template
- Custom post type single page returns 404 error
- Getting hierarchical custom post type permalinks to work just like pages
- Custom post type pagination 404 fix?
- Inconsistent temporary 404s on whole install | PHP error with post-template.php
- Custom post type 404s with rewriting even after resetting permalinks
- Custom post type archive 404’s with paginate_links
- Create page to handle form submission
- 404 on child page when parent page slug is identical to custom post type
- Single custom post type page redirecting to 404 page
- Child pages on hierarchical Custom Post Types 404s
- WordPress custom post type category pagination 404 Error
- Pagination throws 404
- How to save contact form 7 data in Custom Post Types (CPT) [closed]
- How do I redirect all 404 errors of a specific post type to another URL?
- Remove Slug from Custom Post Type results in 404
- How to remove CPT comment feed from head?
- Conditional two level dropdown filter for custom post type
- Dynamic dropdown custom post list based on dropdown selection
- Custom Taxonomy archive returns 404
- Pagination gives 404 error
- How to embed form data within the ‘Add new post’
- Using shortcodes to parse POST request (containing the data from a front-end form)
- Pagination with custom post types results in 404 issues
- Linking three taxonomies with ACF
- Custom query form submission pagination
- Custom Post Type rewrite rules not working, how to alter the rewrite order?
- 404 error on custom post type
- Multisite custom post type’s single page 404
- custom post type and custom taxonomy url conflict
- How to add the post ID (or any other post data) to a Contact Form 7 mail?
- WordPress posts with multiple fields
- How to Submit Post Via cURL & PHP
- An empty Custom Post Type Archive page returns 404 in WP 3.1
- How To Create A Custom Taxonomy 404 Page
- Custom taxonomy in URL showing 404
- Custom Post Type Draft Preview Goes to 404
- How to retain $_POST data when submitting form to custom page
- Display users uploaded files as posts
- Post form as custom post
- How do I display content to users who are not logged in instead of 404 on Private custom posts?
- Help with Elementor Pagination CPT archive 404 problem
- Trouble with CPT Child 404
- Using taxonomy term in CPT permalink – Pages 404’s
- Single post with a Custom Post Type returns 404, when archives of the CPT work correctly
- Form action/link to render a plugin in WordPress front-end
- How to prevent a CPT’s slug and page slug from conflicting with each other?
- How to integrate a form (Ninja Form or Contact Form 7) with Custom Post Types?
- Parent Page and Breadcrumb URL’s for Custom Post Types Not Working
- Custom post type archive pagination 404
- Custom post type permalink tag 404
- Custom post type / taxonomy rewrite archive page 2 gives 404
- Using POST method in meta box, no results
- Hierarchical permalinks for custom post type and taxonomy
- cutsom posts 404ing
- 404 in custom post type feed with mistake permalink
- Page not found for custom post type UI plugin and taxonomy
- How to solve this custom post type goes to 404 page?
- Custom rewrite to fetch feed data
- show custom value from frontend form in a post (custom post type)
- page not found for single-type.php file
- One Custom post type 404’s others don’t
- Custom taxonomy template list not working (404)
- Custom post type slug 404
- Custom Post 404
- Custom taxonomy template shows 404 Error
- Safe to throw 404 error in request filter?
- either single-{custom}.php 404’s OR /taxonomy/ 404’s – custom post type and taxonomy permalinks
- Submit Custom Postypes from frontend
- Custom Post Type Child Won’t Come Through With Pretty Permalinks
- How to submit custom post type front end form when a user buy specific product
- How to upload two input files [closed]
- Change dynamically the dropdown list value
- Custom post type single page 404
- ‘Simple’ Reservation System
- Show custom post status when logged out
- WordPress retrieving $post based on random key in $_POST
- Change the term based on the value of a $variable using wp_update_post in submitting a form
- How can I get custom post types to recognize pretty permalink variables?
- Enabling hierarchical in a Custom Post Type gives error 404
- Standard Page Child of CPT Not Found (404)
- Custom Post Type Front Page Gives 404
- Show ajax form resuslts in page
- Published page but it is page not found
- New entries to custom post type produce 404 on single view
- Some permalinks on Apache/localhost development setup return 404’s when set to anything other than plain permalinks
- 404 error next-page [2] PageNavi custom type taxonomy
- Custom Post Type Rewrite – Page Not Found
- Understanding the workflow of form creation plugin
- How to create a petition like form based on custom post types?
- Front-end form submission not creating post
- Pages displays correctly but returning a 404 error in http header.
- Forms with multiple element types using custom post types
- 404 with Custom Post Type
- Custom Post Type, 404 error
- How to debug a 404 error on pages whose content is perfectly displayed when I explore it?
- From form submission values – dynamically update CPT “has_archive” slug and custom taxonomy “rewrite” slug value
- Custom plugin contact form connecting to mailchimp API
- How to add categories to a custom post type using wp_insert_post($new_post);