WordPress at a glance
Главная Functions Posts, pages...

Category: Posts, pages... 32

edit_post_link()

Displays the edit post link for a post, if the user is allowed to change the post.

get_delete_post_link()

Retrieves the delete posts link for post.

get_edit_post_link()

Retrieves the link (URL) for edit post in admin-panel.

get_permalink()

Gets a permanent link to the current or specified post, for further use in php.

get_post_field()

Gets the value of any post field based on the transmitted post ID: post_type, post_status, post_content ...

get_post_status()

Retrieve the post status based on the Post ID.

get_post_time()

Gets the time of the current post creation in the specified format. You can specify a return format (the default is Unix format). Must be used in WordPress loop.

get_the_content()

Gets the content of the current post. Must be used inside the WordPress loop.

get_the_date()

Gets the creation date of the current post. you can specify an arbitrary date output format. Used in a WordPress loop.

get_the_excerpt()

Retrieves the excerpt of current or defined post. By default, should be used in WordPress Loop.

get_the_ID()

Retrieve the ID of the current post in the WordPress Loop. Can be used only inside the loop.

get_the_modified_date()

Retrieve the date on which the post was last modified.

get_the_modified_time()

Retrieve the time at which the post was last modified.

get_the_permalink()

Gets, rather than displays, the URL of the post that is currently being processed in the Loop. Template tag.

get_the_time()

Gets the time at which the current post was written in the specified format. Used inside the Loop of WordPress.

get_the_title()

Gets the title of the post for further use in php. You can get the title of the specified post.

get_the_title_rss()

Retrieve the current post title for the feed.

has_excerpt()

Whether the post has a custom excerpt.

post_password_required()

Whether post requires password and correct password has been provided.

register_post_status()

Register a post status. Do not use before init.

single_post_title()

Displays or retrieve page title for post. Designed for use on individual post pages.

the_author()

Display the name of the author of the current post.

the_content()

Display the post content. It is template tag and must be used inside the loop.

the_date()

Displays or Retrieve the date of the current post was written. Works with a group of posts (published on the same day).

the_excerpt()

Displays the excerpt (quote) of the post, with [...] at the end (but this is not a link to reading the full material).

the_excerpt_rss()

Display the post excerpt for the feed.

the_ID()

Display the ID of the current post in the WordPress Loop.

the_modified_date()

Display the date on which the post was last modified.

the_permalink()

Displays link (URL) to the post that is currently being processed in the Loop.

the_time()

Display the time (date) at which the post was written in the specified format.

the_title()

Display the current post title with optional HTML markup. It is accepted to use inside the WordPress Loop.

the_title_attribute()

Displays the title of the post prepared (sanitized) for use in the HTML attributes of HTML tag.

Post meta (custom fields)

add_post_meta()

Adds meta field to the specified post.

delete_post_meta()

Remove metadata matching criteria from a post.

get_post_custom()

Retrieve post meta fields, based on post ID.

get_post_custom_keys()

Retrieve meta field names for a post.

get_post_custom_values()

Retrieve values for a custom post field.

get_post_meta()

Retrieve post meta field for a post.

the_meta()

Display list of post custom fields.

update_post_meta()

Update post meta field based on post ID.

Custom Types

add_post_type_support()

Register support of certain features for a post type.

get_post_permalink()

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

get_post_type()

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

get_post_type_archive_link()

Retrieves the permalink for a post type archive.

get_post_type_object()

Retrieves a post type object by name.

get_post_types()

Get a list of all registered post type objects.

get_the_post_type_description()

Retrieves the description for a post type archive.

is_post_type_archive()

Is the query for an existing post type archive page?

is_post_type_hierarchical()

Whether the post type is hierarchical.

is_post_type_viewable()

Determines whether a post type is considered "viewable".

post_type_archive_title()

Display or retrieve title for a post type archive.

post_type_exists()

Check if a post type is registered.

post_type_supports()

Check a post type's support for a given feature.

register_post_type()

Registers a post type.

remove_post_type_support()

Remove support for a feature from a post type.

set_post_type()

Update the post type for the post ID.

unregister_post_type()

Unregisters a post type.

Other

comments_open()

Whether the current post is open for comments.

get_extended()

Divides content into 2 parts: before <!--more--> and after it. Returns an array with the resulting parts.

get_lastpostdate()

Retrieve the date that the last post was published.

get_lastpostmodified()

Get the timestamp of the last time any post was modified.

get_post_embed_html()

Retrieves the embed code for a specific post.

get_post_embed_url()

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

get_post_stati()

Get a list of post statuses.

get_post_statuses()

Retrieve all of the WordPress supported post statuses.

is_sticky()

Check if post is sticky.

pings_open()

Whether the current post is open for pings.

post_exists()

Determine if a post with the specified title (post_title) exists. In addition, for the check, you can pass post_content and post_date.

sanitize_post()

Sanitize every post field.

the_shortlink()

Displays the shortlink for a post.

url_to_postid()

Gets post, page ID by transmitted URL. Examine a URL and try to determine the post ID it represents.

wp_get_canonical_url()

Returns the canonical URL for a post.

wp_get_shortlink()

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

wp_transition_post_status()

Fires action hooks related to the transitioning of a post's status. (from draft to publish, from publish to private, etc.).

Navigation

get_adjacent_post()

Gets the object of the adjacent (next or previous) post.

get_adjacent_post_link()

Gets the adjacent (next/previous) post link (HTML tag A). You can specify limitations on the elements of taxonomies (categories, tags). Can be either next post link or previous.

get_boundary_post()

Retrieves the boundary post.

get_next_post()

Retrieves the next post that is adjacent to the current post. Return post object.

get_next_post_link()

Gets a link (tag A) to the next post relative (by date) to the current post.

get_previous_post()

Retrieves the previous post that is adjacent to the current post. Return post as object.

get_previous_post_link()

Gets a link (tag A) to the previous post relative (by date) to the current post.

get_the_post_navigation()

Gets the navigation links (HTML) to the next and previous posts. Uses on a single post page: is_singular().

next_post_link()

Displays a link (tag A) to the next post relative (by date) to the current post.

previous_post_link()

Displays a link to the previous (by date) post. The function must be used on separate pages (of the is_single() type).

the_post_navigation()

Displays the HTML block of links to the next and previous posts. Uses on a single post page: is_singular().

Pages

get_all_page_ids()

Get a list of page IDs.

get_page_by_path()

Retrieves a page given its path.

get_page_children()

Identify descendants of a given page ID in a list of page objects.

get_page_template_slug()

Gets the specific template name for a given post.

get_page_uri()

Build the URI path for a page.

get_pages()

Retrieve a list of pages (or hierarchical post type items) as an array of posts objects. Analog of get_posts().

get_post_ancestors()

Retrieve ancestors of a post.

page_template_dropdown()

Print out option HTML elements for the page templates drop-down.

parent_dropdown()

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

wp_dropdown_pages()

Retrieve or display list of pages as a dropdown (select list).

wp_link_pages()

The formatted output of a list of pages.

wp_list_pages()

Retrieve or display list of pages (or hierarchical post type items) in list (li) format.

wp_page_menu()

Displays or retrieves a list of pages with an optional home link.

Insert, delete, update

get_default_post_to_edit()

Default post information to use when populating the "Write Post" form.

wp_delete_post()

Trash or delete from the database specified post. The post can be of any type: post, attachment, page, custom type.

wp_insert_post()

Safely insert/update post in the database.

wp_publish_post()

Publish a post by transitioning the post status.

wp_trash_post()

Move a post or page to the Trash

wp_update_post()

Updates a post with new post data in WordPress Database. To work as expected, it is necessary to pass the ID of the post to be updated.

Queries

get_page_by_title()

Retrieve any type of post (page, post, custom type) by given title.

get_post()

Gets the data of the current or specified post. You need to specify post ID, or the function will return the current post. Returns a WP_Post object.

get_posts()

Retrieve list of latest posts or posts matching criteria.

have_posts()

Checks if the current WP query has results for output, i.e. if there are posts available for output on the current page. Conditional tag.

in_the_loop()

Whether the caller is in the Loop.

is_404()

Is the query a 404 (returns no results)?

is_archive()

Conditional tag. Return true when any of the archive pages are shown (Year, Category, Author, Post Type archive...).

is_attachment()

Is the query for an existing attachment page?

is_author()

Is the query for an existing author archive page?

is_category()

Conditional tag. Checks whether the category page is displayed or not.

is_date()

Is the query for an existing date archive?

is_day()

Is the query for an existing day archive?

is_feed()

Is the query for a feed?

is_front_page()

Checks whether the main (home) page of the site is displayed. Conditional tag.

is_home()

The conditional tag that checks if the page with the last posts is displayed, usually it is the main page of the site or the blog homepage.

is_main_query()

Is the query the main query?

is_month()

Is the query for an existing month archive?

is_new_day()

Whether the publish date of the current post in the loop is different from the publish date of the previous post in the loop.

is_page()

Checks whether a "static page" is displaying. You can specify an ID, name, or page title to check a specific page. Conditional tag.

is_paged()

Checks whether the pagination page is displayed (page type /page/2, /page/3). Conditional tag.

is_preview()

Is the query for a post or page preview?

is_search()

Works when the search results page is displayed. Conditional tag.

is_single()

Checks whether the post page of any post type except attachment and page is displayed. Conditional tag.

is_singular()

Checks whether the post page is viewed (post, page, attachment, any post type). Conditional Tag.

is_tag()

Is the query for an existing tag archive page?

is_tax()

Works on the custom taxonomy archive page. Conditional tag.

is_time()

Is the query for a specific time?

is_year()

Is the query for an existing year archive?

query_posts()

Sets up The Loop with query parameters.

rewind_posts()

Rewind the loop posts.

setup_postdata()

Set up the global post data. Useful for easy usage of Template Tags related to the design of the post: the_title(), the_permalink(), etc.

the_post()

Iterate the post index in the loop. Gets the next post, overrides the global variable $post, and sets in the loop property to true.

wp_count_posts()

Gets the number of posts of any post type and any status (publish, draft).

wp_get_recent_posts()

Retrieve the last posts of the website, including drafts, scheduled, and posts on moderation. Gets the last 10 posts only.

wp_reset_postdata()

Restores the global $post variable to the correct state: current post in the main query.

wp_reset_query()

Invalidates (destroys) the data of the last query created for use in an arbitrary WordPress Loop and restores the default loop data.

Formats

get_post_format()

Retrieve the format slug for a post

has_post_format()

Check if a post has any of the given formats, or any format.

set_post_format()

Assign a format to a post

Revisions

wp_delete_auto_drafts()

Delete auto-drafts for new posts that are > 7 days old.

wp_get_post_revision()

Gets a post revision.

wp_get_post_revisions()

Returns all revisions of specified post.

wp_is_post_autosave()

Determines if the specified post is an autosave.

wp_is_post_revision()

Determines if the specified post is a revision.

wp_text_diff()

Displays a human readable HTML representation of the difference between two strings.