-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
35 lines (33 loc) · 1.18 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
/*
Plugin Name: Enable Block Editor for Venues
Description: Enables the Gutenberg block editor for The Events Calendar plugin's Venues post type.
Version: 1.0
Author: Prolific Digital
Author URI: https://prolificdigital.com
License: GPL2
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: enable-block-editor-venues
*/
// Exit if accessed directly
if (! defined('ABSPATH')) {
exit;
}
/**
* Enables the block editor for The Events Calendar plugin's Venues post type.
*
* This function forces the Gutenberg block editor to be enabled for the 'tribe_venue' post type,
* allowing users to use the block editor for editing venue details.
*
* @param bool $can_edit Whether the post type can be edited or not.
* @param string $post_type The post type being checked.
*
* @return bool True if the block editor should be enabled for 'tribe_venue', otherwise the original value of $can_edit.
*/
function myprefix_enable_block_editor_for_venues($can_edit, $post_type) {
if ($post_type === 'tribe_venue') {
return true; // Force enable the block editor
}
return $can_edit;
}
add_filter('use_block_editor_for_post_type', 'myprefix_enable_block_editor_for_venues', 100, 2);