New answers tagged

1 vote
Accepted

Continue execution after WP REST API response

One thing you can do in WordPress is to dispatch a non blocking new request to itself, and then resume the response. Something like this: $action_name = 'sample_action'; $url = add_query_arg( [ ...
Leo Germani's user avatar
0 votes

REST API - Retrieving posts with custom status

Yes, authentication is needed, because the Posts endpoint will check whether the current user has the edit_posts capability – see WP_REST_Posts_Controller::sanitize_post_statuses(). Also, a HTTP ...
Sally CJ's user avatar
  • 38.9k
2 votes
Accepted

How to get a page's featured image through REST API?

Maybe because the custom REST field (fimg_url) was only being added to posts of the post type and yet your request was for Pages, i.e. posts of the page type.. so try changing the register_rest_field( ...
Sally CJ's user avatar
  • 38.9k
1 vote
Accepted

Post current post type to my Ajax

To pass the current post type to your AJAX request, you need to modify your JS to include the post type information in the AJAX request. You can achieve this by adding the post type as a parameter ...
vijay pancholi's user avatar
1 vote

Post current post type to my Ajax

Hi please replace your ajax function like this function filterPosts() { $show_post_types = get_post_types(); $post_type_array = array(); foreach ($show_post_types as $pt) { ...
Pratik bhatt's user avatar
  • 1,230
1 vote

Update user meta via REST API?

With Wordpress Version 6.4.3 I had to do the following: $userMetaProp = 'customMeta'; add_filter('rest_pre_insert_user', static function ( stdClass $prepared_user, WP_REST_Request $...
Lenny4's user avatar
  • 111
1 vote

How to add fee_lines using woocommerce rest API v3?

Here is my code that working fine. "fee_lines": [ { "name": "7.5% Booking Fee", "tax_status": "taxable", &...
Heena's user avatar
  • 11

Top 50 recent answers are included