plugin creating a reusable block
-
Hello,
my plugin creates a reusable block following the suggestion in this support thread:
https://www.ads-software.com/support/topic/how-to-instruct-a-plugin-to-create-a-reusable-block/It all works fine as long as I’m logged-in as the wordpress administrator, however when logged-in as an author I can see the reusable block in the list, but it fails to display properly.
The issue seems to relate to the code checking whether the reusable block is already present:
$my_shortcode_name = 'my short code'; if ( !get_posts( array( 'name' => sanitize_title( $my_shortcode_name ), 'post_type' => 'wp_block', 'posts_per_page' => 1 ) ) ) {
If I remove the check above, the reusable block works properly (but I see many instances in the block selector).
Any reason why the code above would work properly for the site administrator but not work for an author?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘plugin creating a reusable block’ is closed to new replies.