WP_REST_Post_Meta_Fields

Core class used to manage meta values for posts via the REST API.

Defined (1)

The class is defined in the following location(s).

/wp-includes/rest-api/fields/class-wp-rest-post-meta-fields.php  
  1. class WP_REST_Post_Meta_Fields extends WP_REST_Meta_Fields { 
  2.  
  3. /** 
  4. * Post type to register fields for. 
  5. * @since 4.7.0 
  6. * @access protected 
  7. * @var string 
  8. */ 
  9. protected $post_type; 
  10.  
  11. /** 
  12. * Constructor. 
  13. * @since 4.7.0 
  14. * @access public 
  15. * @param string $post_type Post type to register fields for. 
  16. */ 
  17. public function __construct( $post_type ) { 
  18. $this->post_type = $post_type; 
  19.  
  20. /** 
  21. * Retrieves the object meta type. 
  22. * @since 4.7.0 
  23. * @access protected 
  24. * @return string The meta type. 
  25. */ 
  26. protected function get_meta_type() { 
  27. return 'post'; 
  28.  
  29. /** 
  30. * Retrieves the type for register_rest_field(). 
  31. * @since 4.7.0 
  32. * @access public 
  33. * @see register_rest_field() 
  34. * @return string The REST field type. 
  35. */ 
  36. public function get_rest_field_type() { 
  37. return $this->post_type;