I checked what kind of return value of get_queried_object() depends on the page type.
- WordPress 5.3.2
TOC
- Homepage
- Front page
- Single post
- Single page
- Category archive
- Tag archive
- Taxonomy archive
- Custom post archive
- Author archive
- Date archive (year)
- Date archive (month)
- Date archive (day)
- Search
- 404
- Atachment file
Homepage
NULL
Front page
NULL
Single post
object(WP_Post)#4808 (24) {
["ID"]=>
int(1)
["post_author"]=>
string(1) "1"
["post_date"]=>
string(19) "2019-12-16 12:48:44"
["post_date_gmt"]=>
string(19) "2019-12-16 12:48:44"
["post_content"]=>
string(137) "
Welcome to WordPress. This is your first post. Edit or delete it, then start writing!
"
["post_title"]=>
string(12) "Hello world!"
["post_excerpt"]=>
string(0) ""
["post_status"]=>
string(7) "publish"
["comment_status"]=>
string(4) "open"
["ping_status"]=>
string(4) "open"
["post_password"]=>
string(0) ""
["post_name"]=>
string(11) "hello-world"
["to_ping"]=>
string(0) ""
["pinged"]=>
string(0) ""
["post_modified"]=>
string(19) "2019-12-16 12:48:44"
["post_modified_gmt"]=>
string(19) "2019-12-16 12:48:44"
["post_content_filtered"]=>
string(0) ""
["post_parent"]=>
int(0)
["guid"]=>
string(22) "http://work.local/?p=1"
["menu_order"]=>
int(0)
["post_type"]=>
string(4) "post"
["post_mime_type"]=>
string(0) ""
["comment_count"]=>
string(1) "1"
["filter"]=>
string(3) "raw"
}
Single page
object(WP_Post)#366 (24) {
["ID"]=>
int(2)
["post_author"]=>
string(1) "1"
["post_date"]=>
string(19) "2019-12-16 12:48:44"
["post_date_gmt"]=>
string(19) "2019-12-16 12:48:44"
["post_content"]=>
string(76) "
This is an example page.
"
["post_title"]=>
string(11) "Sample Page"
["post_excerpt"]=>
string(0) ""
["post_status"]=>
string(7) "publish"
["comment_status"]=>
string(6) "closed"
["ping_status"]=>
string(4) "open"
["post_password"]=>
string(0) ""
["post_name"]=>
string(11) "sample-page"
["to_ping"]=>
string(0) ""
["pinged"]=>
string(0) ""
["post_modified"]=>
string(19) "2020-03-16 10:53:03"
["post_modified_gmt"]=>
string(19) "2020-03-16 01:53:03"
["post_content_filtered"]=>
string(0) ""
["post_parent"]=>
int(0)
["guid"]=>
string(28) "http://work.local/?page_id=2"
["menu_order"]=>
int(0)
["post_type"]=>
string(4) "page"
["post_mime_type"]=>
string(0) ""
["comment_count"]=>
string(1) "0"
["filter"]=>
string(3) "raw"
}
Category archive
object(WP_Term)#4828 (16) {
["term_id"]=>
int(1)
["name"]=>
string(4) "News"
["slug"]=>
string(4) "news"
["term_group"]=>
int(0)
["term_taxonomy_id"]=>
int(1)
["taxonomy"]=>
string(8) "category"
["description"]=>
string(0) ""
["parent"]=>
int(0)
["count"]=>
int(1)
["filter"]=>
string(3) "raw"
["cat_ID"]=>
int(1)
["category_count"]=>
int(1)
["category_description"]=>
string(0) ""
["cat_name"]=>
string(4) "News"
["category_nicename"]=>
string(4) "news"
["category_parent"]=>
int(0)
}
Tag archive
object(WP_Term)#4818 (10) {
["term_id"]=>
int(7)
["name"]=>
string(12) "サンプル"
["slug"]=>
string(6) "sample"
["term_group"]=>
int(0)
["term_taxonomy_id"]=>
int(7)
["taxonomy"]=>
string(8) "post_tag"
["description"]=>
string(0) ""
["parent"]=>
int(0)
["count"]=>
int(1)
["filter"]=>
string(3) "raw"
}
Taxonomy archive
object(WP_Term)#4824 (10) {
["term_id"]=>
int(8)
["name"]=>
string(4) "pops"
["slug"]=>
string(4) "pops"
["term_group"]=>
int(0)
["term_taxonomy_id"]=>
int(8)
["taxonomy"]=>
string(5) "genre"
["description"]=>
string(0) ""
["parent"]=>
int(0)
["count"]=>
int(1)
["filter"]=>
string(3) "raw"
}
Custom post archive
object(WP_Post_Type)#419 (30) {
["name"]=>
string(7) "product"
["label"]=>
string(8) "Products"
["labels"]=>
object(stdClass)#416 (32) {
["name"]=>
string(8) "Products"
["singular_name"]=>
string(7) "Product"
["add_new"]=>
string(11) "New Product"
["add_new_item"]=>
string(15) "Add New Product"
["edit_item"]=>
string(12) "Edit Product"
["new_item"]=>
string(8) "New Item"
["view_item"]=>
string(12) "View Product"
["view_items"]=>
string(10) "View Items"
["search_items"]=>
string(15) "Search products"
["not_found"]=>
string(17) "No products found"
["not_found_in_trash"]=>
string(26) "No products found in Trash"
["parent_item_colon"]=>
string(15) "Parent Product:"
["all_items"]=>
string(12) "All Products"
["archives"]=>
string(13) "Item Archives"
["attributes"]=>
string(15) "Item Attributes"
["insert_into_item"]=>
string(16) "Insert into item"
["uploaded_to_this_item"]=>
string(21) "Uploaded to this item"
["featured_image"]=>
string(14) "Featured Image"
["set_featured_image"]=>
string(18) "Set featured image"
["remove_featured_image"]=>
string(21) "Remove featured image"
["use_featured_image"]=>
string(21) "Use as featured image"
["filter_items_list"]=>
string(17) "Filter items list"
["items_list_navigation"]=>
string(21) "Items list navigation"
["items_list"]=>
string(10) "Items list"
["item_published"]=>
string(15) "Post published."
["item_published_privately"]=>
string(25) "Post published privately."
["item_reverted_to_draft"]=>
string(23) "Post reverted to draft."
["item_scheduled"]=>
string(15) "Post scheduled."
["item_updated"]=>
string(13) "Post updated."
["menu_name"]=>
string(8) "Products"
["name_admin_bar"]=>
string(7) "Product"
["update_item"]=>
string(14) "Update Product"
}
["description"]=>
string(26) "Product information pages."
["public"]=>
bool(true)
["hierarchical"]=>
bool(false)
["exclude_from_search"]=>
bool(false)
["publicly_queryable"]=>
bool(true)
["show_ui"]=>
bool(true)
["show_in_menu"]=>
bool(true)
["show_in_nav_menus"]=>
bool(true)
["show_in_admin_bar"]=>
bool(true)
["menu_position"]=>
int(5)
["menu_icon"]=>
NULL
["capability_type"]=>
string(4) "page"
["map_meta_cap"]=>
bool(true)
["register_meta_box_cb"]=>
NULL
["taxonomies"]=>
array(1) {
[0]=>
string(5) "genre"
}
["has_archive"]=>
bool(true)
["query_var"]=>
string(7) "product"
["can_export"]=>
bool(true)
["delete_with_user"]=>
NULL
["_builtin"]=>
bool(false)
["_edit_link"]=>
string(16) "post.php?post=%d"
["cap"]=>
object(stdClass)#424 (15) {
["edit_post"]=>
string(9) "edit_page"
["read_post"]=>
string(9) "read_page"
["delete_post"]=>
string(11) "delete_page"
["edit_posts"]=>
string(10) "edit_pages"
["edit_others_posts"]=>
string(17) "edit_others_pages"
["publish_posts"]=>
string(13) "publish_pages"
["read_private_posts"]=>
string(18) "read_private_pages"
["read"]=>
string(4) "read"
["delete_posts"]=>
string(12) "delete_pages"
["delete_private_posts"]=>
string(20) "delete_private_pages"
["delete_published_posts"]=>
string(22) "delete_published_pages"
["delete_others_posts"]=>
string(19) "delete_others_pages"
["edit_private_posts"]=>
string(18) "edit_private_pages"
["edit_published_posts"]=>
string(20) "edit_published_pages"
["create_posts"]=>
string(10) "edit_pages"
}
["rewrite"]=>
array(5) {
["slug"]=>
string(7) "product"
["with_front"]=>
bool(true)
["pages"]=>
bool(true)
["feeds"]=>
bool(true)
["ep_mask"]=>
int(1)
}
["show_in_rest"]=>
bool(false)
["rest_base"]=>
bool(false)
["rest_controller_class"]=>
bool(false)
["rest_controller"]=>
NULL
}
Author archive
object(WP_User)#4818 (8) {
["data"]=>
object(stdClass)#4817 (10) {
["ID"]=>
string(1) "1"
["user_login"]=>
string(5) "admin"
["user_pass"]=>
string(34) "xxxxxxxxxxxxxxxxxxxxxxxxxxx"
["user_nicename"]=>
string(5) "admin"
["user_email"]=>
string(24) "dev-email@flywheel.local"
["user_url"]=>
string(0) ""
["user_registered"]=>
string(19) "2019-12-16 12:48:44"
["user_activation_key"]=>
string(0) ""
["user_status"]=>
string(1) "0"
["display_name"]=>
string(5) "admin"
}
["ID"]=>
int(1)
["caps"]=>
array(1) {
["administrator"]=>
bool(true)
}
["cap_key"]=>
string(15) "wp_capabilities"
["roles"]=>
array(1) {
[0]=>
string(13) "administrator"
}
["allcaps"]=>
array(66) {
["switch_themes"]=>
bool(true)
["edit_themes"]=>
bool(true)
["activate_plugins"]=>
bool(true)
["edit_plugins"]=>
bool(true)
["edit_users"]=>
bool(true)
["edit_files"]=>
bool(true)
["manage_options"]=>
bool(true)
["moderate_comments"]=>
bool(true)
["manage_categories"]=>
bool(true)
["manage_links"]=>
bool(true)
["upload_files"]=>
bool(true)
["import"]=>
bool(true)
["unfiltered_html"]=>
bool(true)
["edit_posts"]=>
bool(true)
["edit_others_posts"]=>
bool(true)
["edit_published_posts"]=>
bool(true)
["publish_posts"]=>
bool(true)
["edit_pages"]=>
bool(true)
["read"]=>
bool(true)
["level_10"]=>
bool(true)
["level_9"]=>
bool(true)
["level_8"]=>
bool(true)
["level_7"]=>
bool(true)
["level_6"]=>
bool(true)
["level_5"]=>
bool(true)
["level_4"]=>
bool(true)
["level_3"]=>
bool(true)
["level_2"]=>
bool(true)
["level_1"]=>
bool(true)
["level_0"]=>
bool(true)
["edit_others_pages"]=>
bool(true)
["edit_published_pages"]=>
bool(true)
["publish_pages"]=>
bool(true)
["delete_pages"]=>
bool(true)
["delete_others_pages"]=>
bool(true)
["delete_published_pages"]=>
bool(true)
["delete_posts"]=>
bool(true)
["delete_others_posts"]=>
bool(true)
["delete_published_posts"]=>
bool(true)
["delete_private_posts"]=>
bool(true)
["edit_private_posts"]=>
bool(true)
["read_private_posts"]=>
bool(true)
["delete_private_pages"]=>
bool(true)
["edit_private_pages"]=>
bool(true)
["read_private_pages"]=>
bool(true)
["delete_users"]=>
bool(true)
["create_users"]=>
bool(true)
["unfiltered_upload"]=>
bool(true)
["edit_dashboard"]=>
bool(true)
["update_plugins"]=>
bool(true)
["delete_plugins"]=>
bool(true)
["install_plugins"]=>
bool(true)
["update_themes"]=>
bool(true)
["install_themes"]=>
bool(true)
["update_core"]=>
bool(true)
["list_users"]=>
bool(true)
["remove_users"]=>
bool(true)
["promote_users"]=>
bool(true)
["edit_theme_options"]=>
bool(true)
["delete_themes"]=>
bool(true)
["export"]=>
bool(true)
["create_blog_partssss"]=>
bool(true)
["create_blog_parts"]=>
bool(true)
["create_ad_tag"]=>
bool(true)
["create_speech_balloon"]=>
bool(true)
["administrator"]=>
bool(true)
}
["filter"]=>
NULL
["site_id":"WP_User":private]=>
int(1)
}
Date archive (year)
NULL
Date archive (month)
NULL
Date archive (day)
NULL
Search
NULL
404
NULL
Atachment file
object(WP_Post)#4800 (24) {
["ID"]=>
int(11)
["post_author"]=>
string(1) "1"
["post_date"]=>
string(19) "2020-03-16 11:02:58"
["post_date_gmt"]=>
string(19) "2020-03-16 02:02:58"
["post_content"]=>
string(0) ""
["post_title"]=>
string(32) "lookoutdevilsthroatDSCF0351_TP_V"
["post_excerpt"]=>
string(0) ""
["post_status"]=>
string(7) "inherit"
["comment_status"]=>
string(4) "open"
["ping_status"]=>
string(6) "closed"
["post_password"]=>
string(0) ""
["post_name"]=>
string(32) "lookoutdevilsthroatdscf0351_tp_v"
["to_ping"]=>
string(0) ""
["pinged"]=>
string(0) ""
["post_modified"]=>
string(19) "2020-03-16 11:02:58"
["post_modified_gmt"]=>
string(19) "2020-03-16 02:02:58"
["post_content_filtered"]=>
string(0) ""
["post_parent"]=>
int(0)
["guid"]=>
string(81) "http://work.local/wp-content/uploads/2020/03/lookoutdevilsthroatDSCF0351_TP_V.jpg"
["menu_order"]=>
int(0)
["post_type"]=>
string(10) "attachment"
["post_mime_type"]=>
string(10) "image/jpeg"
["comment_count"]=>
string(1) "0"
["filter"]=>
string(3) "raw"
}
Top comments (0)