Hi Kyle,
If you do not pass the post ID to the function get_post()
, it only works only on the frontend.
null, false, 0 and other PHP falsey values return the current global post inside the loop
Please read more on the documentation https://developer.wordpress.org/reference/functions/get_post/
The Render Code area in the Builder supports to get the current post ID by using the variable post_id
. For example:
{% set post = mb.get_post( post_id ) %}
{{ post.product_name }}
List of prebuilt variables can be used:
attribute
Block attribute. Replace attribute with anchor, align, or className.
field_id
Field value. Replace field_id with a real field ID.
is_preview
Whether in preview mode.
post_id
Current post ID.