get_post_field unexpected results
-
I am trying to use
get_post_field
to get themenu_order
of posts.
My code looks like$order = get_post_field($id,'menu_order','raw');
When I do a var_dump on $order, I get an empty string.
When I change my code to:
$order = get_post($id)->menu_order;
A var_dump of $order results in an int with the correct
menu_order
from the db. Why the difference? I even looked at theget_post_field
function; it appears to be a wrapper for what my second code set does.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘get_post_field unexpected results’ is closed to new replies.