{"id":50,"date":"2013-12-10T11:22:31","date_gmt":"2013-12-10T11:22:31","guid":{"rendered":"http:\/\/www.eminozlem.com\/?p=50"},"modified":"2015-06-06T21:30:22","modified_gmt":"2015-06-06T21:30:22","slug":"if-you-need-an-id-just-get-an-id","status":"publish","type":"post","link":"https:\/\/eminozlem.com\/tr\/if-you-need-an-id-just-get-an-id\/","title":{"rendered":"If you need an ID just get an ID"},"content":{"rendered":"<p>If you are familiar with WordPress, you should already know that you should almost never have to use <code>get_posts()<\/code>.<br \/>\nYour best bet is to use <code>WP_Query<\/code> . As good as wp_query is, you should still fine-tune it depending on your needs, it does make a difference. For example, if you just need 1 random post ID, just get 1 random post ID by making use of &#8216;fields&#8217;. See the results in the picture.<br \/>\nOf course that goes for all the other query args. Be specific as you can and get only what you need.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you are familiar with WordPress, you should already know that you should almost never have to use get_posts(). Your best bet is to use WP_Query . As good as wp_query is, you should still fine-tune it depending on your needs, it does make a difference. For example, if you just need 1 random post&#8230;<\/p>\n","protected":false},"author":1,"featured_media":51,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","footnotes":""},"categories":[7,2],"tags":[11,68,10],"class_list":["post-50","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-coding","category-wordpress","tag-sql","tag-wordpress","tag-wp_query"],"acf":[],"_links":{"self":[{"href":"https:\/\/eminozlem.com\/tr\/wp-json\/wp\/v2\/posts\/50","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/eminozlem.com\/tr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/eminozlem.com\/tr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/eminozlem.com\/tr\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/eminozlem.com\/tr\/wp-json\/wp\/v2\/comments?post=50"}],"version-history":[{"count":0,"href":"https:\/\/eminozlem.com\/tr\/wp-json\/wp\/v2\/posts\/50\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/eminozlem.com\/tr\/wp-json\/wp\/v2\/media\/51"}],"wp:attachment":[{"href":"https:\/\/eminozlem.com\/tr\/wp-json\/wp\/v2\/media?parent=50"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/eminozlem.com\/tr\/wp-json\/wp\/v2\/categories?post=50"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/eminozlem.com\/tr\/wp-json\/wp\/v2\/tags?post=50"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}