Getting a GET error in console – 404 not found for wp-json

The URL you’re using is not the URL that you’ve registered. This code: register_rest_route( ‘news’, ‘/news’, array( ‘methods’ => ‘GET’, ‘callback’ => ‘custom_api_get_news_callback’ )); Registers this URL: http://localhost:8888/una/wp-json/news/news But you’re sending requests to http://localhost:8888/una/wp-json/news/all-posts Nowhere in your code have you defined an all-posts endpoint. You either need to change /news in register_rest_route() to /all-posts, or … Read more

JSON-LD: creating an AggregateOffer from many shortcode

If you have full control over the system, it would be best to get all of the data by some other means. If you must concatenate the shortcodes, you can parse the content to get the shortcodes with get_shortcode_regex(). You can save all the matches, and their attributes, and remove them from the content. Then, … Read more

ACF save json to custom directory not working, default acf-json used instead

the two filters don’t have the same output. you can test that add_filter(‘acf/json_directory’, function ($path) { return get_template_directory() . ‘/config/acf-json’; }); add_filter(‘acf/settings/save_json’, function ($path) { return apply_filters(“acf/json_directory”, NULL); }); add_filter(‘acf/settings/load_json’, function ($paths) { return [ apply_filters(“acf/json_directory”, NULL) ]; });

Why WordPress not using JSON_UNESCAPED_UNICODE by default?

Because until relatively recently WordPress supported PHP 5.2+, but that constant was only added in PHP 5.4. Given that wp_json_encode is meant to encapsulate and account for the differing behaviour of json_encode across multiple PHP versions, it doesn’t make sense to deliberatly change its behaviour for PHP 5.4+ Now that WordPress has raised its minimum … Read more

Custom WP API endpoint NULL body data

I have solved the issue. It was unrelated to json / javascript / api. It was a simple issue of tmp folder ownership. Since there were no errors spewing out by the php managing the request, I never noticed a PHP NOTICE saying to check permissions in temp folder as php was unable to upload … Read more

Sql formatting for post data within function

It isn’t showing wp_posts.post_content LIKE ‘%test%’ because the wildcards (%) in the prepared statement are converted to placeholder escape strings (like the {a19f0a6c3d866f7270be0f3954cbb2600270400c15f488e112449a8a131701f0} in your post) when wpdb::prepare() calls wpdb::add_placeholder_escape() which “Adds a placeholder escape string, to escape anything that resembles a printf() placeholder“, i.e. a placeholder like %s. But those placeholder escape strings will … Read more

Include results with tags relevant to the search keyword with JSON rest API v2

WP Extended Search does not work with REST by default since version 2.0.2 This is to achieve maximum compatibility with WordPress and other plugin/themes. To enable the support, pass wpessid in REST request with ID (for specific search setting) or without ID (for global search setting). e.g. /wp-json/wp/v2/posts?search=technology&wpessid or /wp-json/wp/v2/posts?search=technology&wpessid=10 Ref: https://wordpress.org/support/topic/search-queries-with-metakey-name-issue-version-2-0-2/#post-14376988 PS:- I am … Read more