Array (
[330] => WP_Post Object (
[ID] => 330
[post_author] => 1
[post_date] => 2019-02-01 21:01:54
[post_date_gmt] => 2019-02-01 21:01:54
[post_content] =>
[post_title] => wordpress-4.9.8
[post_excerpt] =>
[post_status] => inherit
[comment_status] => open
[ping_status] => closed
[post_password] =>
[post_name] => wordpress-4-9-8
[to_ping] =>
[pinged] =>
[post_modified] => 2019-02-01 21:01:54
[post_modified_gmt] => 2019-02-01 21:01:54
[post_content_filtered] =>
[post_parent] => 329
[guid] => http://localhost:8080/brainwise/wp-content/uploads2019/02/wordpress-4.9.8.zip
[menu_order] => 0
[post_type] => attachment
[post_mime_type] => application/zip
[comment_count] => 0
[filter] => raw
)
)
I am using WordPress and I have the following Object Array from my post table and I want to extract guid
element of this array. How do I extract this?
Just use get_the_guid( $post->ID );
.
See: https://developer.wordpress.org/reference/functions/get_the_guid/
获取密钥,然后获取其中的对象
<p>echo $array_name[array_keys($array_name)[0]]->{guid};</p>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.