wp query – Is there a way to extend WP_query so Custom Post Types can have properties?
Having trouble finding info on this. When working with lots of metadata/custom fields, I would really prefer to simplify getting the meta data inside of templates instead of using
get_post_meta and instead keep the setting up of that data in the back-end where it belongs to keep my templates clean and easier to work with.
Is there a way to do this?
<p><?php echo $something->meta_field_name ?></p>
This would be similar to how you can do things like
$post->post_parent that are in WordPress core, except it would be for custom post types and custom fields. If this is not possible, I guess the next question would be, why?
Leave an answer