You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a requirement where I have a particular block added to the FSE template. I only want to render this block from FSE template if the same block is not added to the post content. If the block exists in post content then don't render the block from FSE. To handle this I can set an attribute to the block like isAddedToTemplate if true then use has_block function to check if the block exists in the post content.
But I am looking a way to identify if the block is rendered from the FSE template without using any attribute like isAddedToTemplate. In editor I can use if postType and postId contexts exits or pagenow is 'site-editor' but I am not able find anything similar in the render_callback.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have a requirement where I have a particular block added to the FSE template. I only want to render this block from FSE template if the same block is not added to the post content. If the block exists in post content then don't render the block from FSE. To handle this I can set an attribute to the block like
isAddedToTemplate
if true then usehas_block
function to check if the block exists in the post content.But I am looking a way to identify if the block is rendered from the FSE template without using any attribute like
isAddedToTemplate
. In editor I can use ifpostType
andpostId
contexts exits orpagenow
is 'site-editor' but I am not able find anything similar in therender_callback
.Beta Was this translation helpful? Give feedback.
All reactions