WordPress get content from pages

Developer Resources

Retrieves the post content.

Contents

Parameters

$strip_teaser bool Optional

$post WP_Post | object | int Optional

Return

More Information

When used inside The Loop, this function will get the content of the current post.

If used outside The Loop, you must inform the post you want to get the content from using the optional $post parameter.

An important difference from the_content() is that get_the_content() does not pass the content through the the_content filter. This means that get_the_content() will not auto-embed videos or expand shortcodes, among other things.

Source

Hooks

Filters the Read More link text.

Uses

Generates post data.

Determines whether a $post or a string contains a specific block type.

Balances tags of string using a modified stack.

Removes any invalid control characters in a text string.

Retrieves the number of times an action has been fired during the current request.

Retrieves protected post password form content.

Determines whether the post requires password and whether a correct password has been provided.

Sanitizes the current title when retrieving or displaying.

Retrieves the translation of $text.

Retrieves the full permalink for the current post or post ID.

Calls the callback functions that have been added to a filter hook.

Retrieves post data given a post ID or post object.

Used By

Uses Description
generate_postdata() wp-includes/query.php
Used By

Generates an excerpt from the content, if needed.

Display the post content for the feed.

Retrieves the post content for feeds.

Displays the post content.

Changelog

Used By Description
wp_trim_excerpt() wp-includes/formatting.php
Changelog
Version Description
5.2.0 Added the $post parameter.
0.71 Introduced.

User Contributed Notes

Note that get_the_content doesn’t return the same thing as what the_content displays. For that you need to do this:

Basic Usage
Display the post content, ending with “Read more” if needed

find out if the_content has content before output

in functions.php and similar files:

template inside the loop:

If you’re having trouble getting the $post parameter to work, make sure your WordPress is up-to-date: $post was only added in WordPress 5.2.

If you use get_the_content() before the global $wp_query object is set, the postmeta are not well generated because generate_postdata() use $wp_query.
To get around this issue, just construct a global $wp_query object before calling get_the_content()

You must log in before being able to contribute a note or feedback.

Источник

get_the_content() — возвращает контент поста

Возвращает неотфильтрованный контент поста (под постом подразумевается запись, страница, либо любой другой произвольный тип поста).

Используйте внутри цикла WordPress для получения содержимого текущей записи, либо передайте ID определённого поста в качестве параметра.

Параметры

  • false — по умолчанию полная версия содержимого поста выводится как обычно.
  • true — в этом случае в полной версии поста будет отсутствовать часть контента, которая находится до тега .

$post (целое|WP_Post) ID или объект поста, контент которого мы хотим получить. По умолчанию – текущий пост в цикле. Параметр появился в WP 5.2.

Пример 1. Выводим контент страницы без фильтров

Главное отличие функции get_the_content() от the_content() не в том, что первая функция возвращает результат, а вторая выводит, а в том, что the_content() применяет огромное количество действий на фильтр the_content – там и интерпретация шорткодов, и замена кавычек и многое другое.

Пример 2. Как записать в переменную отфильтрованый контент

Для того, чтобы получить контент записи или страницы с применением всех фильтров, то вы можете использовать следующий код:

Либо буферизацию на функцию the_content():

Пример 3. Вывод содержимого записи/страницы с определённым ID

До версии WordPress 5.2 нам нужно было придумывать что-то в этом роде:

Теперь же всё изменилось с приходом третьего параметра в функцию:

Глобальные переменные

Функция кстати работает со следующими глобальными переменными:

$page (целое) Номер подстраницы при разделении поста по подстраницам тегом $more (логическое) Нужно ли отображать целиком пост или только отрывок до тега . Подробное описание этой глобальной переменной в примере. $pages (массив) Массив контента каждой из подстраниц контента поста, разделённых тегом . $multipage (логическое) Существует ли разделение контента на подстраницы.

Как же так, ведь текст кнопки «Далее» можно указать в первом параметре функции the_content() ? Дело в том, что там вы можете указать только текст ссылки, а фильтр the_content_more_link позволяет полностью изменить её HTML код.

В качестве примера добавим к ссылке «Далее» HTML-атрибут target=»_blank» .

Впервые познакомился с WordPress в 2009 году. Организатор и спикер на конференциях WordCamp. Преподаватель в школе Нетология.

Пишите, если нужна помощь с сайтом или разработка с нуля.

Источник

the_content() – выводит контент страницы или записи

Функция the_content() выводит содержимое текущего поста (записи, страницы или произвольного типа поста) в цикле.

Функция для использования внутри цикла WordPress. Если вам нужен контент не текущей, а определённой записи или страницы, то взляните на get_the_content().

Выводит полностью весь пост, если задействована на страницах:

  • записей (например в файле single.php ),
  • страниц (например в файле page.php ),
  • произвольных типов постов (например это может быть файл single- <тип_поста>).

Выводит только часть контента поста, которая находится до тега на следующих типах страниц:

  • рубрики category.php ,
  • метки tag.php ,
  • таксономии taxonomy.php .
  • поиск search.php ,
  • архивы archive.php ,

По поводу упомянутых файлов – не обязательно для отображения определённого типа страницы может задействоваться именно указанный файл, например для рубрик может использоваться и archive.php , и index.php , для лучшего понимания рекомендую посмотреть видеоурок про иерархию шаблонов.

Параметры

Функция ничего не возвращает.

Пример 1. Выводим контент, изменив при этом текст ссылки «Далее»

По сути в данной ситуации всё, что нам нужно сделать, это задать первый параметр функции.

В этот параметр вы даже можете передать заголовок записи/страницы функцией the_title(), вот так примерно:

Пример 2. Включаем или отключаем обрезку по тегу

Если функция the_content() работает не совсем так, как нам хотелось бы, например обрезает контент по тегу , когда мы этого не хотим, или наоборот, не обрезает, когда хотим, то мы можем изменить это поведение функции при помощи глобальной переменной $more .

Для этого нам нужно:

  1. Определить глобальную переменную перед циклом global $more;
  2. Затем, уже непосредственно перед функцией the_content() , присвоить ей значение 0 (отображать анонсы) или 1 (отображать целиком весь пост), например $more = 0; .

Подробнее про основной цикл читайте / смотрите видеоурок здесь.

Второй пример — возможно вы уже читали пост про прилепленные записи. Так вот, используя условный тег is_sticky(), мы можем сделать так, чтобы для прилепленных записей контент отображался целиком, а для всех остальных записей выводились только анонсы.

the_content — изменяем содержимое поста перед выводом

Как я уже говорил, этот фильтр очень популярен и используется во многих плагинах. Его даже используют для добавления ссылок на похожие записи в конце поста.

Очень рекомендую обратить на этот фильтр внимание, так как благодаря ему WordPress делает с контентом страницы очень много всего перед выводом, например:

  1. Ререндерит блоки, благодаря чему мы можем изменять вывод блоков, как в этом примере.
  2. Производит автоматическую замену кавычек и других символов функцией wptexturize().
  3. Преобразует символы типо 🙂 в смайлики.
  4. Применяет функцию wpautop() для расстановки HTML-тегов абзацев

и переносов строки
.
Убеждается, что в контенте нет шорткодов, обёрнутых в

, если да, то удаляет этот тег.
Затем оборачивает вложения в тег

.

  • Фильтрует такие теги как и , чтобы добавить к ним атрибуты srcset , sizes и loading , которые могли не существовать на момент создания поста.
  • Если сайт использует https:// , то заменяет все http:// на https:// в контенте.
  • Применяет шорткоды функцией do_shortcode().
  • Ещё применяется функция capital_P_dangit(), которая исправляет неправильное написание WordPress (например, когда пишут с маленькой буквы: WordPress или wordpress).
  • Если для вывода контента вы используете например функцию get_the_content(), то ничего из этого применяться не будет!

    Впервые познакомился с WordPress в 2009 году. Организатор и спикер на конференциях WordCamp. Преподаватель в школе Нетология.

    Пишите, если нужна помощь с сайтом или разработка с нуля.

    Источник

    How do I get content from a specific element by ID with the Rest API?

    How would I get the content that is within a specific div by ID using the WP Rest API?

    I can get the page content of the page with the following:

    How would I get the contents of a DIV with an on the page that is referenced above?

    • This topic was modified 3 years ago by bcworkz . Reason: code fixed

    The page content is inserted into the page DOM’s “nav-wrapper” element, so the content is now also part of the page DOM, so you could do something like var myElement = document.getElementById(«remoteContent»); This must be done as part of the success: callback since the element does not exist in the DOM until it’s inserted into nav-wrapper.

    Alternately, use DOMParser().parseFromString() to convert the content string into a separate DOM object, of which you can then use its own .getElementById() method to get the element you want, without needing to insert the entire content into the page’s DOM.

    Thank you bcworks…

    How do I reference a div with an from theContent variable above?

    var theContent = data;

    Something like: theContent.content.#remote-content.rendered;

    I think my issue is that the html outside of the page content (as in elements that are in the theme) are not returned in the “pages” method: https://mysite/wp-json/wp/v2/pages/

    How would I get the contents of an element that is in a WP template code?

    • This reply was modified 3 years ago by cwolff .

    You cannot. API data is “un-themed”, the calling app is expected to apply its own theme. However, if the theme content you are after is stored in the DB somewhere, you can probably still get at it through the API if you can determine where the data is stored. For example, if the theme template includes

    you cannot get such content from the API. But if the template includes

    then you can use the API to get the saved value through the /posts API route as long as the meta field is registered to be served with post data.

    Thank you again bcworkz,

    Is it possible to register a route/endpoint to make my WP menuing/navigation consumable via wp_nav_menu()?

    Источник

    Developer Resources

    Retrieves post data given a post ID or post object.

    Contents

    Description

    See sanitize_post() for optional $filter values. Also, the parameter $post , must be given as a variable, since it is passed by reference.

    Parameters

    $output string Optional

    $filter string Optional

    Return

    WP_Post|array|null Type corresponding to $output on success or null on failure.
    When $output is OBJECT, a WP_Post instance is returned.

    Source

    Uses

    Sanitizes every post field.

    Used By

    Uses Description
    WP_Post::__construct() wp-includes/class-wp-post.php
    Used By

    Returns the latest revision ID and count of revisions for a post.

    Returns the url for viewing and potentially restoring revisions of a given post.

    Returns the custom post type that contains the user’s origin config for the active theme or a void array if none are found.

    Creates a single post.

    Updates a single nav menu item.

    Deletes a single menu item.

    Prepares a single post for create or update.

    Get the post, if the ID is valid.

    Updates a single global style config.

    Prepares a single global styles config for update.

    Sets a custom slug when creating auto-draft template parts.

    Sets the current WP_Query to return auto-draft posts.

    Updates a single template.

    Creates a single template.

    Gets the next or previous image link that has the same post parent.

    Overrides the result of the post password check for REST requested posts.

    Determine whether post should always use a plain permalink structure.

    Determines whether a post is publicly viewable.

    Retrieves the parent post object for the given post.

    Fires actions after a post, its terms and meta data has been saved.

    Applies edits to a media item and creates a new attachment record.

    Gets the REST API route for a post.

    Returns the user request object for the specified request ID.

    Inserts the attachment post in the database. Does not update the attachment meta.

    Performs post processing on an attachment.

    Retrieves post published or modified time as a DateTimeImmutable object instance.

    Ajax handler for creating missing image sub-sizes for just uploaded images.

    Generate post data.

    Creates, updates or deletes an autosave revision.

    Creates autosave for the specified post.

    Checks if a given request has access to read blocks.

    Returns block output from block’s registered render_callback.

    Prepares the search result for a given ID.

    Prepares links for the search result of a given ID.

    Determines whether a post or content string has blocks.

    Determines whether a $post or a string contains a specific block type.

    Returns whether the post can be edited in the block editor.

    Add a notice with a link to the guide when editing the privacy policy page.

    Resend an existing request and return the result.

    Trashes or deletes a changeset post.

    Checks whether the template is valid for the given post.

    Get the revision, if the ID is valid.

    Get the parent post, if the ID is valid.

    Gets the post, if the ID is valid.

    Get the comment, if the ID is valid.

    Deletes auto-draft posts associated with the supplied changeset.

    Render the media on the frontend.

    Render the media on the frontend.

    Filters the default media display states for items in the Media list table.

    Determine if the supplied attachment is for a valid attachment post with the specified MIME type.

    Render the media on the frontend.

    Publishes the values of a changeset.

    Saves the post for the loaded changeset.

    Imports theme starter content into the customized state.

    Gets the data stored in a changeset post.

    Updates the custom_css post for a given theme.

    Fetches the custom_css post for a given theme.

    Creates a single attachment.

    Updates a single attachment.

    Checks if a request has access to read terms in the specified taxonomy.

    Checks if a post can be read.

    Sets the template for a post.

    Prepares a single post for create or update.

    Creates a single post.

    Updates a single post.

    Deletes a single post.

    Checks if the comment can be read.

    Prepares links for the request.

    Updates a comment.

    Checks if a given request has access to read the comment.

    Checks if a given request has access to create a comment.

    Checks if a given request has access to read comments.

    Sanitizes post IDs for posts created for nav menu items to be published.

    Adds a new auto-draft post.

    Get original title.

    Filters post thumbnail lookup to set the post thumbnail.

    Returns the canonical URL for a post.

    Retrieves the caption for an attachment.

    Returns a post array ready to be inserted into the posts table as a post revision.

    Adds a trashed suffix for a given post.

    Retrieves the URL to embed a specific post in an iframe.

    Retrieves the embed code for a specific post.

    Retrieves the oEmbed response data for a given post.

    Prints JavaScript settings for parent window.

    Check whether a non-public property is set.

    Handles the submission of a comment, usually posted to wp-comments-post.php via a comment form.

    Retrieves the URL used for the post preview.

    Get the instance data for a given nav_menu_item setting.

    Performs the post_type and taxonomy queries for loading available menu items.

    Handles the title column output.

    Creates an attachment ‘object’.

    Ajax handler for cropping an image.

    Handles the parent column output.

    Verifies an attachment is of a given type.

    Set up global post data.

    Handler for updating the current site’s posts count when a post is deleted.

    Apply Ajax handlers to a string.

    Construct the upgrader for a form.

    Fetches a screen object.

    Outputs list of taxonomy terms, in XML tag format, associated with a post.

    Gets an existing post and format it for editing.

    Streams image in post to browser, along with enqueued changes in $_REQUEST[‘history’] .

    Saves image to post, along with enqueued changes in $_REQUEST[‘history’] .

    Generates attachment meta data and create image sub-sizes for images.

    The Quick Draft widget display and creation of drafts.

    Displays the post password.

    Prints the form in the Custom Fields meta box.

    Prints out HTML form date elements for editing post or comment publish date.

    Prints out option HTML elements for the page parents drop-down.

    Retrieves a list of the most popular terms from the specified taxonomy.

    Displays the multi-file uploader message.

    Displays non-editable attachment metadata in the publish meta box.

    Retrieves the media element HTML to send to the editor.

    Retrieves the attachment fields to edit form fields.

    Retrieves HTML for media items of post gallery.

    Retrieves HTML form for modifying the image attachment.

    Handles form submissions for the legacy media uploader.

    Saves a file submitted from a POST request and create an attachment post for it.

    Handles a side-loaded file in the same way as an uploaded file is handled by media_handle_upload() .

    Adds the media button to the editor.

    Returns the HTML of the sample permalink slug editor.

    Returns HTML for the post thumbnail meta box.

    Determines whether the post is currently being edited by another user.

    Marks the post as currently being edited by the current user.

    Outputs the HTML for the notice to say that someone else is editing or has taken over editing of this post.

    Creates autosave data for the specified post from $_POST data.

    Saves a draft or manually autosaves for the purpose of showing a post preview.

    Saves a post submitted with XHR.

    Replaces hrefs of attachment anchors with up-to-date permalinks.

    Returns a sample permalink based on the post name.

    Updates an existing post with values provided in $_POST .

    Processes the post data for the bulk editing of posts.

    Returns default post information to use when populating the “Write Post” form.

    Ajax handler for saving the attachment order.

    Ajax handler for sending an attachment to the editor.

    Ajax handler for sending a link to the editor.

    Ajax handler for getting revision diffs.

    Ajax handler for saving posts from the fullscreen editor.

    Ajax handler for removing a post lock.

    Ajax handler for getting an attachment.

    Ajax handler for updating attachment attributes.

    Ajax handler for saving backward compatible attachment attributes.

    Ajax handler for adding a menu item.

    Ajax handler for adding meta.

    Ajax handler for Quick Edit saving a post from a list table.

    Ajax handler for deleting a post.

    Ajax handler for sending a post to the Trash.

    Ajax handler to delete a page.

    Ajax handler for replying to a comment.

    Get the revision UI diff.

    Prepare revisions for JavaScript.

    Start the element output.

    Prints the appropriate response to a menu quick search.

    Displays a meta box for a post type menu item.

    Given a top level page ID, display the nested hierarchy of sub-pages together with paging support

    Create an attachment ‘object’.

    Returns whether the author of the supplied post has the specified capability.

    Maps a capability to the primitive capabilities required of the given user to satisfy the capability being checked.

    Handles customize_save WP Ajax request to save/update a changeset.

    Checks if the current post has any of given terms.

    Retrieves the terms of the taxonomy that are attached to the post.

    Generates an excerpt from the content, if needed.

    Notifies an author (and/or others) of a comment/trackback/pingback on a post.

    Notifies the moderator of the site about a new comment that is awaiting approval.

    Displays the links to the extra feeds such as category feeds.

    Retrieves the date on which the post was last modified.

    Retrieves the time at which the post was written.

    Retrieves the time at which the post was written.

    Retrieves the time at which the post was last modified.

    Retrieves the time at which the post was last modified.

    Displays the weekday on which the post was written.

    Displays the weekday on which the post was written.

    Outputs the date in iso8601 format for xml files.

    Retrieves the date on which the post was written.

    Retrieve a single post, based on post ID.

    Get parent post relational link.

    Retrieve HTML content of attachment image with link.

    Retrieve icon URL and Path.

    Retrieve HTML content of icon attachment image element.

    Retrieve HTML content of image element.

    Whether user can edit a post.

    Retrieves all post data for a given post.

    Sets up the WordPress Loop.

    Retrieves the currently queried object.

    Retrieves an array of posts based on query variables.

    Permanently deletes comments or posts of any type that have held a status of ‘trash’ for the number of days defined in EMPTY_TRASH_DAYS.

    Checks content for video and audio links to add as enclosures.

    Triggers a caching of all oEmbed results.

    If a post/page was saved, then output JavaScript to make an Ajax request that will call WP_Embed::cache_oembed().

    The do_shortcode() callback function.

    Retrieves all taxonomies associated with a post.

    Retrieves all taxonomy names for the given post.

    Returns a shortlink for a post, page, attachment, or site.

    Displays the shortlink for a post.

    Retrieves the adjacent post link.

    Retrieves the adjacent post.

    Retrieves the adjacent post relational link.

    Retrieves the boundary post.

    Retrieves the edit post link for post.

    Displays the edit post link for post.

    Retrieves the delete posts link for post.

    Retrieves the permalink for the post comments feed.

    Displays the permalink anchor for the current post.

    Retrieves the full permalink for the current post or post ID.

    Retrieves the permalink for a post of a custom post type.

    Retrieves the permalink for the current page or page ID.

    Retrieves the page permalink.

    Retrieves the permalink for an attachment.

    Provides an edit link for posts and terms.

    Retrieves the post thumbnail ID.

    Retrieves the post thumbnail.

    Outputs the beginning of the current element in the tree.

    Retrieves an attachment page link using an image or icon, if possible.

    Wraps attachment in paragraph tag before content.

    Retrieves protected post password form content.

    Gets the specific template filename for a given post.

    Retrieves formatted date timestamp of a revision (linked to that revisions’s page).

    Retrieves formatted date timestamp of a revision (linked to that revisions’s page).

    Displays a list of a post’s revisions.

    Determines whether the post requires password and whether a correct password has been provided.

    Retrieves the Post Global Unique Identifier (guid).

    Retrieves the post content.

    Retrieves the post excerpt.

    Determines whether the post has a custom excerpt.

    Retrieves an array of the class names for the post container element.

    Retrieves an array of the class names for the body element.

    Retrieves the ID of the current item in the WordPress Loop.

    Sanitizes the current title when retrieving or displaying.

    Retrieves the post title.

    Displays the Post Global Unique Identifier (guid).

    Retrieves galleries from the passed post’s content.

    Prepares an attachment post object for JS, where it is expected to be JSON-encoded and fit into an Attachment model.

    Enqueues all scripts, styles, settings, and templates necessary to use all media JS APIs.

    Retrieves media attached to the passed post.

    Builds the Video shortcode output.

    Retrieves taxonomies attached to given the attachment.

    Builds the Gallery shortcode output.

    Builds the Playlist shortcode output.

    Builds the Audio shortcode output.

    Gets an HTML img element representing an image attachment.

    Will clean the post in the cache.

    Returns the ID of the post’s parent.

    Sets the post thumbnail (featured image) for the given post.

    Removes the thumbnail (featured image) from the given post.

    Retrieves the icon for a MIME type or attachment.

    Trashes or deletes an attachment.

    Retrieves attachment metadata for attachment ID.

    Updates metadata for an attachment.

    Retrieves the URL for an attachment.

    Retrieves thumbnail for an attachment.

    Retrieves URLs already pinged for a post.

    Retrieves URLs that need to be pinged.

    Does trackbacks for a list of URLs.

    Retrieves page data given a page ID or page object.

    Retrieves a page given its path.

    Retrieves a page given its title.

    Builds the URI path for a page.

    Determines whether an attachment URI is local and really an attachment.

    Publishes a post by transitioning the post status.

    Publishes future post and make sure post ID has future post status.

    Computes a unique slug for the post, when given the desired slug and some post details.

    Adds a URL to those already pinged.

    Restores comments for a post from the Trash.

    Inserts or update a post.

    Updates a post with new post data.

    Trashes or deletes a post or page.

    Resets the page_on_front, show_on_front, and page_for_post settings when a linked page is deleted or trashed.

    Moves a post or page to the Trash

    Restores a post from the Trash.

    Moves comments for a post to the Trash.

    Retrieves the IDs of the ancestors of a post.

    Retrieves data from a post field based on Post ID.

    Retrieves the mime type of an attachment based on the ID.

    Retrieves the post status based on the post ID.

    Retrieves the post type of the current post or of a given post.

    Updates attachment file path based on attachment ID.

    Examines a URL and try to determine the post ID it represents.

    Redirects incoming links to the proper URL based on the site url.

    Inserts post data into the posts table as a post revision.

    Gets a post revision.

    Returns all revisions of specified post.

    Filters terms lookup to set the post format.

    Determines which fields of posts are to be saved in revisions.

    Creates a revision for the current version of a post.

    Retrieves the autosaved data of the specified post.

    Gets a blog post from any site on the network.

    Retrieve the format slug for a post

    Assign a format to a post

    Retrieves the number of posts by the author of the current post.

    Retrieves the author who last edited the current post.

    Handler for updating the current site’s last updated date when a published post is deleted.

    Decorates a menu item object with the shared navigation menu item properties.

    Saves the properties of a menu item or create a new one.

    Retrieve post categories.

    Sets categories for a post.

    Retrieve trackbacks sent to a given post.

    Sets a post’s publish status to ‘publish’.

    Retrieves a pingback and registers it.

    Retrieve array of URLs that pingbacked the given URL.

    Uploads a file, following your settings.

    Retrieve a media item by ID

    Retrieve revisions for a specific post.

    Restore a post revision

    Create new comment.

    Retrieve comment count.

    Prepares page data for return in an XML-RPC object.

    Helper method for wp_newPost() and wp_editPost(), containing shared logic.

    Edit a post for any registered post type.

    Delete a post for any registered post type.

    Retrieve a post.

    Prepares post data for return in an XML-RPC object.

    Render the control’s content.

    Retrieves HTML content for reply to post link.

    Outputs a complete commenting form for use within a template.

    Determines whether the current post is open for comments.

    Determines whether the current post is open for pings.

    Displays form token for unfiltered comments.

    Retrieves HTML content for reply to comment link.

    Retrieves the amount of comments a post has.

    Returns the classes for the comment div as an array.

    Closes comments on an old post. Hooked to comments_open and pings_open.

    Updates an existing comment in the database.

    Updates the comment count for the post.

    Pings back the links found in a post.

    Show 336 more used by Hide more used by

    Changelog

    Used By Description
    wp_get_latest_revision_id_and_total_count() wp-includes/revision.php
    WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles() wp-includes/class-wp-theme-json-resolver.php
    WP_REST_Menu_Items_Controller::create_item() wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php
    WP_REST_Menu_Items_Controller::update_item() wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php
    WP_REST_Menu_Items_Controller::delete_item() wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php
    WP_REST_Menu_Items_Controller::prepare_item_for_database() wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php
    WP_REST_Global_Styles_Controller::get_post() wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php
    WP_REST_Global_Styles_Controller::update_item() wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php
    WP_REST_Global_Styles_Controller::prepare_item_for_database() wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php
    WP_REST_Templates_Controller::update_item() wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php
    WP_REST_Templates_Controller::create_item() wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php
    WP_REST_Posts_Controller::check_password_required() wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
    WP_REST_Attachments_Controller::edit_media_item() wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
    WP_REST_Attachments_Controller::insert_attachment() wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
    WP_REST_Attachments_Controller::post_process_item() wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
    WP_REST_Autosaves_Controller::create_item() wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php
    WP_REST_Autosaves_Controller::create_post_autosave() wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php
    WP_REST_Block_Renderer_Controller::get_item_permissions_check() wp-includes/rest-api/endpoints/class-wp-rest-block-renderer-controller.php
    WP_REST_Block_Renderer_Controller::get_item() wp-includes/rest-api/endpoints/class-wp-rest-block-renderer-controller.php
    WP_REST_Post_Search_Handler::prepare_item() wp-includes/rest-api/search/class-wp-rest-post-search-handler.php
    WP_REST_Post_Search_Handler::prepare_item_links() wp-includes/rest-api/search/class-wp-rest-post-search-handler.php
    WP_Privacy_Policy_Content::notice() wp-admin/includes/class-wp-privacy-policy-content.php
    _wp_privacy_resend_request() wp-admin/includes/privacy-tools.php
    WP_Customize_Manager::trash_changeset_post() wp-includes/class-wp-customize-manager.php
    WP_REST_Posts_Controller::check_template() wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
    WP_REST_Revisions_Controller::get_revision() wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php
    WP_REST_Revisions_Controller::get_parent() wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php
    WP_REST_Posts_Controller::get_post() wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
    WP_REST_Comments_Controller::get_comment() wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
    WP_Widget_Media_Audio::render_media() wp-includes/widgets/class-wp-widget-media-audio.php
    WP_Widget_Media_Video::render_media() wp-includes/widgets/class-wp-widget-media-video.php
    WP_Widget_Media::display_media_state() wp-includes/widgets/class-wp-widget-media.php
    WP_Widget_Media::is_attachment_with_mime_type() wp-includes/widgets/class-wp-widget-media.php
    WP_Widget_Media_Image::render_media() wp-includes/widgets/class-wp-widget-media-image.php
    WP_Customize_Manager::_publish_changeset_values() wp-includes/class-wp-customize-manager.php
    WP_Customize_Manager::save_changeset_post() wp-includes/class-wp-customize-manager.php
    WP_Customize_Manager::import_theme_starter_content() wp-includes/class-wp-customize-manager.php
    WP_Customize_Manager::get_changeset_post_data() wp-includes/class-wp-customize-manager.php
    WP_REST_Attachments_Controller::create_item() wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
    WP_REST_Attachments_Controller::update_item() wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
    WP_REST_Terms_Controller::get_items_permissions_check() wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php
    WP_REST_Posts_Controller::check_read_permission() wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
    WP_REST_Posts_Controller::handle_template() wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
    WP_REST_Posts_Controller::prepare_item_for_database() wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
    WP_REST_Posts_Controller::create_item() wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
    WP_REST_Posts_Controller::update_item() wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
    WP_REST_Posts_Controller::delete_item() wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
    WP_REST_Comments_Controller::check_read_permission() wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
    WP_REST_Comments_Controller::prepare_links() wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
    WP_REST_Comments_Controller::update_item() wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
    WP_REST_Comments_Controller::get_item_permissions_check() wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
    WP_REST_Comments_Controller::create_item_permissions_check() wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
    WP_REST_Comments_Controller::get_items_permissions_check() wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
    WP_Customize_Nav_Menus::sanitize_nav_menus_created_posts() wp-includes/class-wp-customize-nav-menus.php
    WP_Customize_Nav_Menus::insert_auto_draft_post() wp-includes/class-wp-customize-nav-menus.php
    WP_Customize_Nav_Menu_Item_Setting::get_original_title() wp-includes/customize/class-wp-customize-nav-menu-item-setting.php
    WP_Customize_Manager::customize_pane_settings() wp-includes/class-wp-customize-manager.php
    WP_Customize_Nav_Menu_Item_Setting::value() wp-includes/customize/class-wp-customize-nav-menu-item-setting.php
    WP_Customize_Nav_Menus::load_available_items_query() wp-includes/class-wp-customize-nav-menus.php
    WP_Posts_List_Table::column_title() wp-admin/includes/class-wp-posts-list-table.php
    WP_Site_Icon::create_attachment_object() wp-admin/includes/class-wp-site-icon.php
    WP_Media_List_Table::column_parent() wp-admin/includes/class-wp-media-list-table.php
    wp_ajax_parse_media_shortcode() wp-admin/includes/ajax-actions.php
    File_Upload_Upgrader::__construct() wp-admin/includes/class-file-upload-upgrader.php
    WP_Screen::get() wp-admin/includes/class-wp-screen.php
    get_compat_media_markup() wp-admin/includes/media.php
    media_upload_form_handler() wp-admin/includes/media.php
    WP_Comments_List_Table::column_response() wp-admin/includes/class-wp-comments-list-table.php
    WP_Comments_List_Table::single_row() wp-admin/includes/class-wp-comments-list-table.php
    Walker_Nav_Menu_Edit::start_el() wp-admin/includes/class-walker-nav-menu-edit.php
    WP_Posts_List_Table::single_row() wp-admin/includes/class-wp-posts-list-table.php
    WP_Posts_List_Table::_page_rows() wp-admin/includes/class-wp-posts-list-table.php
    Custom_Image_Header::create_attachment_object() wp-admin/includes/class-custom-image-header.php
    WP_Customize_Manager::save() wp-includes/class-wp-customize-manager.php
    get_post_thumbnail_id() wp-includes/post-thumbnail-template.php
    get_the_post_thumbnail() wp-includes/post-thumbnail-template.php
    wp_xmlrpc_server::mt_getPostCategories() wp-includes/class-wp-xmlrpc-server.php
    wp_xmlrpc_server::mt_setPostCategories() wp-includes/class-wp-xmlrpc-server.php
    wp_xmlrpc_server::mt_getTrackbackPings() wp-includes/class-wp-xmlrpc-server.php
    wp_xmlrpc_server::mt_publishPost() wp-includes/class-wp-xmlrpc-server.php
    wp_xmlrpc_server::pingback_ping() wp-includes/class-wp-xmlrpc-server.php
    wp_xmlrpc_server::pingback_extensions_getPingbacks() wp-includes/class-wp-xmlrpc-server.php
    wp_xmlrpc_server::mw_editPost() wp-includes/class-wp-xmlrpc-server.php
    wp_xmlrpc_server::mw_getPost() wp-includes/class-wp-xmlrpc-server.php
    wp_xmlrpc_server::mw_newMediaObject() wp-includes/class-wp-xmlrpc-server.php
    wp_xmlrpc_server::blogger_getPost() wp-includes/class-wp-xmlrpc-server.php
    wp_xmlrpc_server::blogger_editPost() wp-includes/class-wp-xmlrpc-server.php
    wp_xmlrpc_server::blogger_deletePost() wp-includes/class-wp-xmlrpc-server.php
    wp_xmlrpc_server::wp_getMediaItem() wp-includes/class-wp-xmlrpc-server.php
    wp_xmlrpc_server::wp_getRevisions() wp-includes/class-wp-xmlrpc-server.php
    wp_xmlrpc_server::wp_restoreRevision() wp-includes/class-wp-xmlrpc-server.php
    wp_xmlrpc_server::wp_newComment() wp-includes/class-wp-xmlrpc-server.php
    wp_xmlrpc_server::wp_getCommentCount() wp-includes/class-wp-xmlrpc-server.php
    wp_xmlrpc_server::wp_deletePage() wp-includes/class-wp-xmlrpc-server.php
    wp_xmlrpc_server::wp_editPage() wp-includes/class-wp-xmlrpc-server.php
    wp_xmlrpc_server::wp_getPage() wp-includes/class-wp-xmlrpc-server.php
    wp_xmlrpc_server::_prepare_page() wp-includes/class-wp-xmlrpc-server.php
    wp_xmlrpc_server::_insert_post() wp-includes/class-wp-xmlrpc-server.php
    wp_xmlrpc_server::wp_editPost() wp-includes/class-wp-xmlrpc-server.php
    wp_xmlrpc_server::wp_deletePost() wp-includes/class-wp-xmlrpc-server.php
    wp_xmlrpc_server::wp_getPost() wp-includes/class-wp-xmlrpc-server.php
    wp_xmlrpc_server::_prepare_post() wp-includes/class-wp-xmlrpc-server.php
    WP_Customize_Control::render_content() wp-includes/class-wp-customize-control.php
    _WP_Editors::editor_settings() wp-includes/class-wp-editor.php
    Changelog
    Version Description
    1.5.1 Introduced.

    User Contributed Notes

    For reference, WP_Post OBJECT contains following fields:

    Wouldn’t it be better practice to use get_the_title(..) in this case? directly accessing the post object’s data member would bypass applying filters and enforcing protected and private settings, unless that’s explicitly desired.

    If you need special things—[shortcodes], paragraph tags, anything exciting—in the content, you should apply the filters as opposed to using do_shortcode().

    To get the title for a post with ID 7:

    Alternatively, specify the $output parameter:

    If you want to get a post by slug, you could do a new WP_Query, or use the get_page_by_path function: https://developer.wordpress.org/reference/functions/get_page_by_path/

    You’ll need to use the post_type if you are not getting a page.

    For Reference : WP_Post Object has following properties, which are returned by get_post().

    To Get author of the Post

    If you have a shortcode in the content you should use:

    Feedback

    If you need the content use post_content :

    Change 1 to the post ID. — By Chiss22 — 3 years ago

    Either Al’s or Chiss’ way will work, depending on the value of second parameter. Chiss’ version does not process shortcodes. — By crstauf — 3 years ago

    You must log in before being able to contribute a note or feedback.

    Источник

    Читайте также:  Заправка картриджей xerox статья
    Поделиться с друзьями
    КомпСовет
    Adblock
    detector