-
cliff
There’s Post Title and URLs and such, but there’s no Post ID option. https://share.zight.com/DOuyBWJw
-
Alvind
Hi there,
If you want to fetch the Post ID, you can add this snippet:
add_action('init', function () { if (class_exists('GenerateBlocks_Register_Dynamic_Tag')) { new GenerateBlocks_Register_Dynamic_Tag( [ 'title' => esc_html__('Post ID', 'generateblocks'), 'tag' => 'post_id', 'type' => 'post', 'supports' => ['source'], 'return' => function ($options, $block, $instance) { $post_id = GenerateBlocks_Dynamic_Tags::get_id($options, 'post', $instance); if (! $post_id) { // Fallback if no specific ID is found in the context (should usually be handled by get_id) $post_id = get_the_ID(); } return GenerateBlocks_Dynamic_Tag_Callbacks::output((string) $post_id, $options, $instance); }, ] ); } });
The Post ID will then be available from the Dynamic Tag selection: https://cln.sh/Z3Dyd1Zn
-
cliff
tyvm. is that able to be added to the plugin itself/native?
-
Alvind
It’s not in the plan at the moment, but it will be considered.
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.