WordPress plugin called “YITH WooCommerce Questions and Answers Premium”, Its data is not showing in REST API’s

I am using a plugin to add questions and answers to Woocomerce products, it works fine on webiste but when I try to get data through API those questions and answers are not in cluded in API. And this plugin is not using any post type so we can get data separately. What i can do now?

Are there any instances of any rules for Tabaxi that say they only need 4 hours of rest?

One of my players has just started playing a tabaxi, she is sure she read rules that as a racial trait she only needs 4 hours for a long rest. However neither of us can find rules stating this. She is happy not doing it but I just wanted to confirm have these long rest rules ever stood for tabaxi?

I have referred to DnD beyond and have the official rules for tabaxi in physical form and confirmed for 5e it is 8 hours.

What I am asking is if there is a source she may have read, either from an older version of DnD, or pathfinder or an unofficial rule or UA that was not progeressed at all. She accepts it is possible she either mis read or just imagined reading it somewhere.

Composer Installed Package with WordPress Rest API Endpoint

I am trying to use the Square SDK with a WordPress website. I installed Composer and the Square SDK. I created a WP_Rest_API, but when trying to use the Square classes inside of the .php file, I get an error.

  1. I created a new plugin in my wordpress plugins folder.
  2. In the .php file inside my plugin, I require the "autoload.php" file of Composer from my root directory.
  3. When trying to use the classes from the Square SDK I get an error.

Why?

Thank you!

Custom Post Type and Custom REST API Endpoint result in Gutenberg editor not working

I have a custom post type (article) and have implemented a custom REST API endpoint for that post type. I can retrieve single and multiple articles via the custom endpoint without any issues.

However, when I try to add a new or edit an existing article post within WP Admin, I just get a white screen. The web console shows an error that the rest route does not exist but it is using the standard WP REST Route "No route was found matching the URL and request method." The GET call is to /wp-json/wp/v2/article. The route should be /wp-json/kbs/v1/articles – and that route works. When registering the post type I have the following args…

'show_in_rest'          => true, 'rest_base'             => 'articles', 'rest_controller_class' => 'KBS_Articles_API' 

How can I ensure that WP uses the correct route when loading the block editor? Editing with the classic editor works fine.

Headers already sent error with get_template_part in REST API call

Crosspost from StackOverflow

I’ve looked at multiple other questions about this warning (Headers already sent…etc) and this thorough explanation, but I’m not finding a solution for the circumstances I’m dealing with:

  1. I have a custom WordPress REST API endpoint that returns the output of get_template_part. When I just call get_template_part normally on a page, there’s no warning. It only appears when it runs in register_rest_route‘s callback.
  2. I am also fetching data from an external API using this library. The error started when I started making these requests. I’ve tried making the request both inside and outside the template part, the latter either within register_rest_route‘s callback or as an init action.
  3. The line that triggers the error is an img tag, where I’m echo-ing a URL as the src using data from the external API response. There are other echo calls all over this template, so I doubt that’s the issue.
  4. The line in question actually works fine and does its job. I just need to get rid of the accursed warning.

Code:

Inside functions.php:

<?php    //the api endpoint declaration   add_action( 'rest_api_init', function () {     register_rest_route(         'theme/v2',   // namespace         '/homepage',  // route         array(                  // options             'methods'  => 'GET',             'callback' => 'build_home',         )     );   });    //the callback for the wordpress api   function build_home() {      // this is the external API request, using their PHP library.      // I linked the library above. The request returns an object with a bunch of data     include_once(get_template_directory()."/arena/arena.php");     $  arena = new Arena();     $  page = $  arena->set_page();      $  per = 8;      $  slug = 'concepts-bo-6ajlvpqg';      $  channel = $  arena->get_channel($  slug, array('page' => $  page, 'per' => $  per));      //I'm passing the response from the external API (in $  channel) to get_template part     //get_template_part is then the output for the wordpress API request     get_template_part('custom-home-template',null,array('channel'=>$  channel));  }   ?> 

Inside template part:

<?php   $  channel=$  args["channel"];   ?>    <div id="concepts-box" class="bodycontent reg-width">     <?php foreach ($  channel->contents as $  item) { if($  item->class=="Image"){       $  img=$  item->image["square"]["url"];       ?>     <div class="concept-wrapper">       <!-- the line below is the one that triggers the error -->       <img lozad src="<?=$  img; ?>">     </div>     <?php }} ?>   </div> 

Full warning:

<b>Warning</b>:  Cannot modify header information - headers already sent by (output started at /filepath/wp-content/themes/theme/custom-home-template.php:63) in <b>/filepath/wp-includes/rest-api/class-wp-rest-server.php</b> on line <b>1372</b><br /> 

Is 4 hours long enough for a long rest for Elves?

The Long Rest rules read:

A long rest is a period of extended downtime, at least 8 hours long, during which you sleep or perform light activity: reading, talking, eating, or standing watch for no more than 2 hours of the rest period. If the rest is interrupted by a strenuous activity—such as attacking, taking damage, or casting a spell—you must start the rest over to gain any benefit from it, unless the interruption takes less than an hour. You must have at least 1 hit point to take a long rest. At the end of the rest, you regain all your hit points and half of your maximum number of Hit Dice (round up). You cannot benefit from more than one long rest in a 24-hour period.

The elven Trance racial trait reads as:

Trance: Elves do not need to sleep. Instead, they meditate deeply for 4 hours a day. (The Common word for such meditation is “trance.”) While meditating, you can dream after a fashion; such dreams are actually mental exercises that have become reflexive through years of practice. After resting in this way, you gain the same benefit that a human does from 8 hours of sleep.

I have heard two views regarding these rules:

  • An Elf can get the benefit of a Long Rest in only 4 hours.
  • The 4 hours only applies to not being exhausted, 8 hours is still required get the benefits of a Long Rest.

Which is it? Please provide supporting information, possibly from previous versions.

Can I as a Bloodhunter create mutagens without doing a short or long rest?

As a 2020 version of the Bloodhunter/mutagen order, at lvl 3 I can create one mutagens in a short/long rest.

I read this handbook:

As a possible fix: Instead of preparing your mutagens during a rest, you prepare reagents for mutagens.

Creating a mutagen requires one minute of uninterrupted work with these reagents and a set of alchemist’s tools. This allows the Blood Hunter a bit more flexibility with their mutagens, but not so much that they can change them during combat."

I don´t really understand where he gets that with the reagents. I can´t find it in the books and nothing about it on the internet.

This way I could do a 1 min pause and prepare the mutagen without doing a short rest.

I hope you can help me to understand it better.

How does one calculate effects of damage over time if one is taking a long rest?

In a particular adventure, the air in the lower levels is poisoned, causing 1d6 poison dmg every hour.

If a party take a long rest in such an environment, how do you calculate the cumulative effects of the poison air damage over time in combination with the restorative effects of the long rest?

PHB pg 186 At the end of a long rest, a character regains all hit points.

Does this mean, RAW, the characters take 8d6 damage during the long rest, but then ‘wake up’ at full HP? If after the nth hour, they drop to 0HP and start rolling Death Saves, if they save, and make it to 8hr, they wake up full HP?

Seems like it shouldn’t work that way but I can’t find any suggestion in the books it would be otherwise.

Add post meta fields, when creating a post using WordPress’ REST API

In the documentation for /posts for WordPress REST API it states that I can add a meta-field. But it doesn’t say which format that should be in.

I can find other guides showing how it should be if using Postman:

data = {   "title": "test",   "content": "testingfrompython",   "status": "draft",   "author": 1,   "meta": {     "location": "NYC",     "date": "never",     "event_url": "http: //google.com"   },   "featured_media": 1221 } 

But how should it be setup, if I’m call the endpoint using PHP and cURL?


This here works for just creating a post:

$  data = [   'title'   => 'Test post',   'status'  => 'draft',    'content' => 'Some content', ]; $  data_string = json_encode( $  data );  $  endpoint = 'https://example.org/wp-json/wp/v2/posts'; $  protocol = "POST";  $  headers = [   'Content-Type: application/json',   'Content-Length: ' . strlen($  data_string)   'Authorization: Basic ' . base64_encode( 'MYUSERSEMAIL:APPLICATIONPASSWORD' ) ];  $  ch = custom_setup_curl_function( $  endpoint, $  protocol, $  data_string, $  headers ); $  result = json_decode( curl_exec($  ch) ); 

I’ve tried all kind of things:

Attempt1

$  data = [   'title'   => 'Test post',   'status'  => 'draft',    'content' => 'Some content',   'meta' => [     'my_custom_field' => 'Testing 1234'   ] ]; 

Attempt2

$  data = [   'title'   => 'Test post',   'status'  => 'draft',    'content' => 'Some content',   'meta' => [     [       'key' => 'my_custom_field',        'value' => 'Testing 1234'      ]   ] ]; 

… And I could keep going. Every time it simply creates a post, but doesn’t add any of the meta-data to my created custom fields.

I don’t get why this is not stated in the documentation for the REST API.