I can’t get those posts from the wordpress to ionic

The API endpoint for the post type ‘accomodation’ is /wp-json/wp/v2/posts?type=accomodation Custom Post Types however are not shown in the API by default. You can enable this per Post Type by adding show_in_rest’ => true, to the register_post_type arguments. Documentation can be found here

WP query retrieve the src of attached image

You can use wp_get_attachment_image_src and get your desired sized image and then pass onto your array : foreach( $posts as $post ) { $imgsrc = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), “medium” ); $imgsrc = $imgsrc[0]; $output[] = array( ‘id’ => $post->ID, ‘title’ => $post->post_title, ‘count’ => $post->custom_total_hits, ‘soundcloud_url’ => $post->soundcloud_song, ‘soundcloud_id’ => $post->soundcloud_ids, ‘link’ => get_permalink($post), ‘image_src’ => … Read more

Get the name of the post type

My sleuthing methods go like this: Look for an XML sitemap. If the site uses a common plugin like Yoast SEO and generates sitemaps, often the URLs will give you enough clues to figure out what the post types are named. Unfortunately, it doesn’t appear this site is using any XML sitemap plugins. Look for … Read more

How to send json data to jquery

You could use one of these. It would give you json data. $data = json_encode( array(‘status’ => 200, ‘message’ => ‘success’); $result = wp_send_json_success( array( ‘photo_id’ => $photo_id_encode,’upload_msg’ => ‘Success’ ) );

Can’t get_users info by using json_encode

Try this code function get_users(){ $all_users = get_users(); $arr=array(); foreach ($all_users as $val) { $arr[]=array( ‘value’=> $val->data->user_nicename, ‘label’=> $val->data->display_name, ‘icon’ => get_avatar_url($val->ID)); } wp_send_json($arr); }