I added a custom endpoint 'product'
in the pages.
add_action( 'init', 'add_endpoints');
function add_endpoints() {
add_rewrite( 'product', EP_PAGES );
}
I added a shortcode called `'dashboard' shortcode in a page.
add_shortcode( 'ims-dashboard', 'dashboard' );
public function dashboard() {
global $wp_query;
return ims_get_template_html( 'admin-panel/admin-panel.php' );
}
When i access the page https://localhost/dashboard-2/product, it is rendered correctly.
But whenever I access the page https://localhost/dashboard-2/product/add, the
Oops! That page can’t be found.
is occurred.
I want to load the different page when the url is https://localhost/dashboard-2/product/add.
I added a custom endpoint 'product'
in the pages.
add_action( 'init', 'add_endpoints');
function add_endpoints() {
add_rewrite( 'product', EP_PAGES );
}
I added a shortcode called `'dashboard' shortcode in a page.
add_shortcode( 'ims-dashboard', 'dashboard' );
public function dashboard() {
global $wp_query;
return ims_get_template_html( 'admin-panel/admin-panel.php' );
}
When i access the page https://localhost/dashboard-2/product, it is rendered correctly.
But whenever I access the page https://localhost/dashboard-2/product/add, the
Oops! That page can’t be found.
is occurred.
I want to load the different page when the url is https://localhost/dashboard-2/product/add.
Share Improve this question asked Apr 4, 2019 at 6:19 Sagar Bahadur TamangSagar Bahadur Tamang 1331 silver badge10 bronze badges 6 | Show 1 more comment1 Answer
Reset to default 0I have WooCommerce installed. It has registered the product post type which was conflicting with it.
I renamed to endpoint and it works.
product
on your site? If so, change the name of the endpoint - e.g. toproduct2
.. And there's a typo in the question - it'sadd_rewrite_endpoint()
, notadd_rewrite()
. – Sally CJ Commented Apr 4, 2019 at 6:52product
in your case. – Sally CJ Commented Apr 4, 2019 at 7:02