我正在我的一个插件中使用wp\\u video\\u shortcode\\u override filter。我想将此设置为on option top user,以便其在默认情况下不处于活动状态。我设置了以下场景。我需要打电话给wpdb,从我的插件中获取一些选项。这是好建筑吗?
add_action(\'init\', \'foo_init_setup\');
function foo_init_setup() {
global $wpdb;
$settings_table = $wpdb->prefix . "foo_settings";
$result = $wpdb->get_row("SELECT options FROM {$settings_table} WHERE id = \'0\'", ARRAY_A);
$settings = unserialize($result[\'options\']);
$overide_video = (bool)($settings["overide_video"]);
if($overide_video)add_filter(\'wp_video_shortcode_override\', \'foo_video_shortcode_override\', 10, 2 );
}
function foo_video_shortcode_override( $html, $attr ) {
//something here
};