On this page
WP_Post::__construct( WP_Post|object $post )
Constructor.
Parameters
$postWP_Post|object Required-
Post object.
Source
File: wp-includes/class-wp-post.php. View all references
public function __construct( $post ) {
foreach ( get_object_vars( $post ) as $key => $value ) {
$this->$key = $value;
}
}
Related
Used By
| Used By | Description |
|---|---|
| WP_Customize_Nav_Menu_Item_Setting::value_as_wp_post_nav_menu_item() wp-includes/customize/class-wp-customize-nav-menu-item-setting.php | Get the value emulated into a WP_Post and set up as a nav_menu_item. |
| get_attachment_fields_to_edit() wp-admin/includes/media.php | Retrieves the attachment fields to edit form fields. |
| get_default_post_to_edit() wp-admin/includes/post.php | Returns default post information to use when populating the “Write Post” form. |
| WP_Post::get_instance() wp-includes/class-wp-post.php | Retrieve WP_Post instance. |
| get_post() wp-includes/post.php | Retrieves post data given a post ID or post object. |
Changelog
| Version | Description |
|---|---|
| 3.5.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_post/__construct