33734

How to get raw post content created by REST API call?

<h3>Question</h3>

When I use the REST API I can create a new post and in the result is a content raw property and a rendered property

{ id: 141, date: '2020-06-01T21:33:00', slug: 'my-page-3', status: 'publish', type: 'post', link: 'https://www.example.com/blog/my-page-3/', title: { raw: 'My Page', rendered: 'My Page' }, content: { raw: 'The content', rendered: '

The content

', } }

How do I get that raw value using PHP? Here's the PHP I have:

<?php if (have_posts() ): while (have_posts() ) :the_post(); ?> <div id="content"> <div id="post"> <div> <?php the_title(); ?> </div> <div> <?php the_content(); ?> </div> </div> </div> <?php endwhile; wp_reset_query(); wp_reset_postdata(); endif; ?>

Is there a call like this:

<?php the_content_raw(); ?>

I tried this and don't see that property:

<pre><?php echo var_dump($post); ?></pre>

That gives a list of properties like this:

object(WP_Post)#631 (24) { ["ID"]=> int(141) ["post_author"]=> string(1) "2" ["post_date"]=> string(19) "2020-06-01 21:33:00" ["post_date_gmt"]=> string(19) "2020-06-01 21:33:00" ["post_content"]=> string(76912) ""

But no raw content.

来源:https://stackoverflow.com/questions/62398446/how-to-get-raw-post-content-created-by-rest-api-call

Recommend

  • How should i post my output of a DataFrame from my juptyer notebook in Stack overflow post?
  • mysql-新增数据库
  • format lookupset expression
  • Can connect between hyperledger composer and Android app?
  • FB wall posting OAuthException
  • Cycle R,G,B vales as HUE?
  • UIImage to UIColor array of pixel colors
  • iOS - open another application that exists on the phone?
  • E: Malformed entry 1 in list file /etc/apt/sources.list.d/sbt.list (Suite)
  • Google Apps Script fails to generate image from EmbeddedChartBuilder
  • Map Annotation Disclosure Indicator - Xamarin.Form
  • Questions related to Garbage Collector and finalize() method
  • Battery life if using GPS and background app ios/android
  • Creating http response as a return value for mockito
  • How to run Daphne Server (Django Channels) & workers in the background?
  • Adding Dynamic Row and Data on Checkbox Click
  • iOS App crashed com.apple.root.background-qos
  • Disabling swipe gesture in Windows Phone 8.1 pivot control
  • Showing image on a acro text field position
  • UIScrollView does not restore properly
  • Why do you need 2 Javascript files for cross-platform Cordova plugin?
  • Controller or RestController
  • Generate and export point cloud from Project Tango
  • Ember.js + JQuery-UI Tooltip - Tooltip does not reflect the model / controller changes
  • How to write seo friendly url's using htaccess?
  • concise way of flattening multiindex columns
  • JQuery: Infinite input select
  • Unable to create Access token grant type in wso2 API manager store to test API
  • 'url' requires a non-empty first argument. The syntax changed in Django 1.5, see the docs
  • How to use Streams api peek() function and make it work?
  • How to decleare char *const argv[] in swift [duplicate]
  • read part of h5 dataset python
  • How to encrypt Connectionstring written in web.config from codebehind?
  • Apple Mach-O Linker error (“duplicate symbol”)
  • How to get rgb from transparent pixel in js
  • How to call different template for different category archive page in woocommerce
  • Call Microservice from another Microservice within Docker
  • WPF custom control and direct content support