Ajax store response json in variables
Ajax store response json in variables
Ajax store response json in variables
As this is too much for a comment, I’ll post here and delete later: http://example.org // domain ?json=get_recent_posts // controller # Arguments for the query start here &post_type=mytype &custom_fields=myfield &include=title,custom_fields &meta_key=myfield &meta_value=myvalue Have you tried the following? Debug the response: http://www.example.org/api/get_page_index/?dev=1 Widget-style JSONP output: http://www.example.org/api/get_recent_posts/?callback=show_posts_widget&read_more=More&count=3 Redirect on error: http://www.example.org/api/posts/create_post/?callback_error=http%3A%2F%2Fwww.example.org%2Fhelp.html And could you post what you … Read more
I’ve never worked with that plugin and a new JSON Rest API will maybe be included in core with one of the future versions. So far it’s as well available as plugin. To make it short: There currently seems to only be three kinds of Controllers in that plugin Core Posts Respond But there’s a … Read more
Ha… While this makes a lot of sense, WP is not to good with arbitrary conditions like this and nothing like is implemented in WP_Query currently. However since your issue is really chronological rather than requiring dealing with IDs, you probably can make use of Date Parameters to restrict results to be older than time … Read more
Firstly, your problem with the last post type and/or term overwriting all previous is because ‘filter’ is a 2-dimensional array. Therefore ‘taxonomy’ (the key in this case) can only have one value. If that seems odd, read this super helpful page on the plugin’s github that helped me a lot (read this) tldr; term lists … Read more
get_category_posts/?slug=cat1&post_type=project I forgot to set post_type.
You are doing the right thing. In theory you can probably intercept the “normal” API request and modify the relevant wp_query to whatever you need, but this will mean that you are changing and overriding that API and if you will need it in its “virgin” form at some point it will not be available. … Read more
As @TheDeadMedic mentioned the API will exclude any meta with underscore. It’s not a good idea to remove the underscore as it might break something in your code or dependencies, however you can try adding a code like this in your functions.php to unprotect the desired meta add_filter( ‘is_protected_meta’, ‘wp692_meta_unprotect’, 10, 2 ); function wp692_meta_unprotect( … Read more
I assume you’re using this plugin? From the docs it seems you can use standard query arguments, so try: /api/get_posts/?job_loc=yangon&page=10&count=5
You are using name in your terms. In default, try to use the existing term id ( in your case, cat ID and tag ID ). If you see https://plugins.trac.wordpress.org/browser/rest-api/trunk/lib/endpoints/class-wp-rest-posts-controller.php#L918 they will handle your term with sanitize them into non-negative integer using absint. I hope this help. Here example code to hook rest_insert_{$this->post_type} to create … Read more