Problem with custom WordPress Rest API search route with query parameters

It isn’t reading the acceptable image type parameter because there is no code to read it, and the acceptable image types have been hardcoded here: array( ‘key’ => ‘accepted_image_type’, ‘value’ => array(‘print’, ‘glass-plate’), ‘compare’ => ‘IN’, ), Much like you did here for the search parameter: $search_query = $data[‘s’]; It needs to do the same … Read more

How to Create Custom Route to a page in WordPress

To set up a custom route in WordPress, you can use the add_rewrite_rule() function. This function allows you to specify a regular expression (regex) pattern for matching URLs and a corresponding rewrite rule for redirecting matching URLs to the desired destination. Below is an example of how you could use this function to create a … Read more

Extend page routing with custom parameters

In your case you need to register custom post type for your projects. You can do it by using register_post_type function: add_action( ‘init’, ‘wpse8170_register_post_type’ ); function wpse8170_register_post_type() { register_post_type( ‘wpse8170-projects’, array( ‘label’ => ‘Projects’, ‘public’ => true, ‘rewrite’ => array( ‘slug’ => ‘project’ ), ) ); } Don’t forget to flush rewrite rules. After you … Read more

Route to custom file

This is just simple. First create a page and use slug for it as custom. And then rename you php file to page-custom.php and that would be it.

How to create “page” used for generating PDF? [closed]

Since it’s a standalone script, you can just link to it directly and WordPress will be none the wiser. Just make sure you get the link right – if it’s in your theme, it will be something like: http://example.com/wp-content/themes/my-theme/generate-pdf.php Don’t hardcode the URL though, use the available template functions: <a href=”https://wordpress.stackexchange.com/questions/199196/<?php bloginfo(“template_url’ ) ?>/generate-pdf.php”>Generate!</a> Of … Read more