WP_Query::generate_cache_key()wp-includes/class-wp-query.php |
Generates cache key.
|
get_template_hierarchy()wp-includes/block-template-utils.php |
Gets the template hierarchy for the given template slug to be created.
|
WP_REST_Block_Patterns_Controller::get_items_permissions_check()wp-includes/rest-api/endpoints/class-wp-rest-block-patterns-controller.php |
Checks whether a given request has permission to read block patterns.
|
WP_REST_Block_Pattern_Categories_Controller::get_items_permissions_check()wp-includes/rest-api/endpoints/class-wp-rest-block-pattern-categories-controller.php |
Checks whether a given request has permission to read block patterns.
|
WP_REST_Global_Styles_Controller::get_theme_item_permissions_check()wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php |
Checks if a given request has access to read a single theme global styles config.
|
WP_REST_Menu_Items_Controller::check_has_read_only_access()wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php |
Checks whether the current user has read permission for the endpoint.
|
WP_REST_URL_Details_Controller::permissions_check()wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php |
Checks whether a given request has permission to read remote URLs.
|
WP_REST_Menus_Controller::check_has_read_only_access()wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php |
Checks whether the current user has read permission for the endpoint.
|
_build_block_template_result_from_post()wp-includes/block-template-utils.php |
Builds a unified template object based a post Object.
|
WP_REST_Templates_Controller::get_items_permissions_check()wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php |
Checks if a given request has access to read templates.
|
WP_REST_Templates_Controller::get_item_permissions_check()wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php |
Checks if a given request has access to read a single template.
|
WP_REST_Pattern_Directory_Controller::get_items_permissions_check()wp-includes/rest-api/endpoints/class-wp-rest-pattern-directory-controller.php |
Checks whether a given request has permission to view the local block pattern directory.
|
WP_REST_Server::add_active_theme_link_to_index()wp-includes/rest-api/class-wp-rest-server.php |
Adds a link to the active theme for users who have proper permissions.
|
WP_REST_Themes_Controller::check_read_active_theme_permission()wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php |
Checks if a theme can be read.
|
do_all_trackbacks()wp-includes/comment.php |
Performs all trackbacks.
|
do_all_enclosures()wp-includes/comment.php |
Performs all enclosures.
|
do_all_pingbacks()wp-includes/comment.php |
Performs all pingbacks.
|
WP_REST_Block_Types_Controller::check_read_permission()wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php |
Checks whether a given block type should be visible.
|
WP_Sitemaps_Users::get_users_query_args()wp-includes/sitemaps/providers/class-wp-sitemaps-users.php |
Returns the query args for retrieving users to list in the sitemap.
|
WP_Sitemaps_Posts::get_object_subtypes()wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php |
Returns the public post types, which excludes nav_items and similar types.
|
WP_REST_Post_Search_Handler::__construct()wp-includes/rest-api/search/class-wp-rest-post-search-handler.php |
Constructor.
|
WP_Theme::get_post_templates()wp-includes/class-wp-theme.php |
Returns the theme’s post templates.
|
create_initial_rest_routes()wp-includes/rest-api.php |
Registers default REST API routes.
|
WP_REST_Users_Controller::get_collection_params()wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php |
Retrieves the query params for collections.
|
WP_REST_Users_Controller::get_items_permissions_check()wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php |
Permissions check for getting all users.
|
WP_REST_Users_Controller::get_items()wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php |
Retrieves all users.
|
WP_REST_Users_Controller::get_item_permissions_check()wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php |
Checks if a given request has access to read a user.
|
WP_REST_Post_Statuses_Controller::check_read_permission()wp-includes/rest-api/endpoints/class-wp-rest-post-statuses-controller.php |
Checks whether a given post status should be visible.
|
WP_REST_Post_Statuses_Controller::get_items_permissions_check()wp-includes/rest-api/endpoints/class-wp-rest-post-statuses-controller.php |
Checks whether a given request has permission to read post statuses.
|
WP_REST_Post_Types_Controller::get_items_permissions_check()wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php |
Checks whether a given request has permission to read types.
|
WP_REST_Post_Types_Controller::get_items()wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php |
Retrieves all public post types.
|
get_post_embed_url()wp-includes/embed.php |
Retrieves the URL to embed a specific post in an iframe.
|
WP_Screen::render_view_mode()wp-admin/includes/class-wp-screen.php |
Renders the list table view mode preferences.
|
WP_Customize_Nav_Menus::search_available_items_query()wp-includes/class-wp-customize-nav-menus.php |
Performs post queries for available-item searching.
|
WP_Customize_Nav_Menus::available_item_types()wp-includes/class-wp-customize-nav-menus.php |
Returns an array of all the available item types.
|
export_wp()wp-admin/includes/export.php |
Generates the WXR export file for download.
|
set_screen_options()wp-admin/includes/misc.php |
Saves option for number of rows when listing posts, pages, comments, etc.
|
wp_delete_user()wp-admin/includes/user.php |
Delete user and optionally reassign posts and links to another user.
|
wp_edit_posts_query()wp-admin/includes/post.php |
Runs the query to fetch the posts for listing on the edit posts page.
|
wp_ajax_menu_get_metabox()wp-admin/includes/ajax-actions.php |
Handles for retrieving menu meta boxes via AJAX.
|
wp_ajax_find_posts()wp-admin/includes/ajax-actions.php |
Handles querying posts for the Find Posts modal via AJAX.
|
WP_Terms_List_Table::__construct()wp-admin/includes/class-wp-terms-list-table.php |
Constructor.
|
wp_nav_menu_post_type_meta_boxes()wp-admin/includes/nav-menu.php |
Creates meta boxes for any post type menu item.
|
WP::parse_request()wp-includes/class-wp.php |
Parses the request to find the correct WordPress query.
|
WP_Query::get_posts()wp-includes/class-wp-query.php |
Retrieves an array of posts based on query variables.
|
WP_Embed::cache_oembed()wp-includes/class-wp-embed.php |
Triggers a caching of all oEmbed results.
|
get_permalink()wp-includes/link-template.php |
Retrieves the full permalink for the current post or post ID.
|
wp_admin_bar_new_content_menu()wp-includes/admin-bar.php |
Adds “Add New” menu.
|
WP_User_Query::prepare_query()wp-includes/class-wp-user-query.php |
Prepares the query variables.
|
_get_last_post_time()wp-includes/post.php |
Gets the timestamp of the last time any post was modified or published.
|
get_pages()wp-includes/post.php |
Retrieves an array of pages (or hierarchical post type items).
|
_add_post_type_submenus()wp-includes/post.php |
Adds submenus for post types.
|
WP_Rewrite::generate_rewrite_rules()wp-includes/class-wp-rewrite.php |
Generates rewrite rules from a permalink structure.
|
redirect_guess_404_permalink()wp-includes/canonical.php |
Attempts to guess the correct URL for a 404 request based on query vars.
|
url_to_postid()wp-includes/rewrite.php |
Examines a URL and try to determine the post ID it represents.
|
wp_xmlrpc_server::wp_getPostTypes()wp-includes/class-wp-xmlrpc-server.php |
Retrieves post types.
|
_WP_Editors::wp_link_query()wp-includes/class-wp-editor.php |
Performs post queries for internal linking.
|
Skip to note 10 content
tleifj
Argument values for $args include:
Skip to note 11 content
Codex
Output a list of only custom post types which are public
By setting
'_builtin'tofalse, we exclude the WordPress built-in public post types (post,page,attachment,revision, andnav_menu_item) and retrieve only registered custom public post types.true, '_builtin' => false ); $output = 'names'; // 'names' or 'objects' (default: 'names') $operator = 'and'; // 'and' or 'or' (default: 'and') $post_types = get_post_types( $args, $output, $operator ); if ( $post_types ) { // If there are any custom public post types. echo '<ul>'; foreach ( $post_types as $post_type ) { echo '<li>' . $post_type . '</li>'; } echo '</ul>'; } ?>_builtinoption also ignores the following:custom_css,customize_changeset,oembed_cache,user_request,wp_block,wp_template.Skip to note 12 content
Codex
Retrieve a named post type as an object
This example uses the
'object'output to retrieve the post type called ‘movies’ and display its name, singular name and menu icon (an URL):'movies', ); $post_types = get_post_types( $args, 'objects' ); foreach ( $post_types as $post_type ) { echo '<p>Custom Post Type name: ' . $post_type->name . "<br />n"; echo 'Single name: ' . $post_type->labels->singular_name . "<br />n"; echo 'Menu icon URL: ' . $post_type->menu_icon . "</p>n";; } ?>Skip to note 13 content
Md. Jwel Miah
Get post types array with name => singular name
function prefix_get_post_types() { $post_types = get_post_types([], 'objects'); $posts = array(); foreach ($post_types as $post_type) { $posts[$post_type->name] = $post_type->labels->singular_name; } return $posts; }You can use this function in a select dropdown option where user can select a post type form existing post types.
Skip to note 14 content
Mostafa Soufi
Display the HTML dropdown list of Post Types.
true, ); $post_types = get_post_types( $args, 'objects' ); ?> <select class="widefat" name="post_type"> <option value="<?php echo esc_attr( $post_type_obj->name ); ?>">name ); ?></option> </select>Skip to note 15 content
Codex
Output a list of the names of all registered post types
Uses
'names'as$outputargument value.'; foreach ( $post_types as $post_type ) { echo '<li>' . $post_type . '</li>'; } echo '</ul>'; ?>Skip to note 16 content
Muhammad Ayoub
Display the HTML dropdown list of Post Types, including custom post types
true), 'names', 'and'); ?> <select class="" name="post_type"> <option value="<?php echo esc_attr($post_type); ?>"></option> </select> ?>Skip to note 17 content
Codex
Default Usage
Retrieves the names (in an array) of all built-in and custom post types.
Skip to note 18 content
Shashikant Yadav
Remove specific post type
$post_types = get_post_types( array( 'public' => true, '_builtin' => true ), 'names', 'and' ); // remove attachment from the list unset( $post_types['attachment'] ); echo '<ul>'; foreach ( $post_types as $post_type ) { echo '<li>' . $post_type . '</li>'; } echo '</ul>';attachmentpost type from the$post_typesvariable; it does not actually unregister (“remove”) theattachmentpost type.