Why aren’t tags and categories added in post request to WP Rest API

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

Parsing php string in jquery [closed]

Well it seems @JacobPeattie mentioned to use json, I just echoing that. First json encode the variable $array = json_encode($out); Then send this value echo ‘<div data-ad = ‘.$array.’ class=”ash_loadmore”><span>LOAD MORE</span></div>’; To get that echo json_encode($_POST[‘ad’]) I think that’s it.BTW you don’t have now that string problem as the output will be like this {“footer-insta”:2,”sidebar-1″:3} … Read more

Where to access the available plugin/WordPress updates?

Plugin update data is cached in the update_plugins site transient with available updates under the response property. $data = get_site_transient( ‘update_plugins’ ); var_dump( $data->response ); Response looks a bit like: array(1) { [“wordpress-seo/wp-seo.php”]=> object(stdClass)#1873 (11) { [“id”]=> string(27) “w.org/plugins/wordpress-seo” [“slug”]=> string(13) “wordpress-seo” [“plugin”]=> string(24) “wordpress-seo/wp-seo.php” [“new_version”]=> string(5) “5.5.1” [“url”]=> string(44) “https://wordpress.org/plugins/wordpress-seo/” [“package”]=> string(62) “https://downloads.wordpress.org/plugin/wordpress-seo.5.5.1.zip” [“icons”]=> … Read more

Customize JSON output

This code will do the job: $args = array( ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => -1, ); $query = new WP_Query( $args ); $posts = array(); $categories = array(); $json = array(); while( $query->have_posts() ) : $query->the_post(); $post_categories = get_the_category(); $post_category = current($post_categories); $categories[] = array( ‘name’ => $post_category->name ); $posts[] = array( … Read more

var is undefined in a Gutenberg block

I think you have to pass in menu_selected edit: withAPIData( ( props ) => { return { menu_selected: `/menus/v1/menus/${ props.attributes.menu }` // custom endpoint }; } ) ( ( { menu_selected } ) => { I was able to do a very similar thing like so: edit: withAPIData( () => { return { posts: ‘/wp/v2/images?per_page=4&_embed’ … Read more

Why does AWStats show /wp-json* as Viewed URLs

I’m not entirely sure what will be better explanation, or why this one (the real one) is not enough. In your stats you see URLs of requests and not paths to files. URL has nothing to do with files on server. Yes – if the requests targets physical file, then that file exists, but… There … Read more