我从另一家开发公司得到的这个主题到处都是add_action/filter( \'hook/filter\', create_function( \'\', \'return blah(\'blah\')\' );
我们将此站点移动到运行php 7.2
.
我想知道删除这些操作和过滤器的合适方法是什么。或者我可以简单地将/path/to/file复制并粘贴到子目录中,然后知道这将被覆盖吗?
这里有一个例子
if ( ! function_exists( \'ot_register_theme_options_page\' ) ) {
function ot_register_theme_options_page() {
/* get the settings array */
$get_settings = _ut_theme_options();
/* sections array */
$sections = isset( $get_settings[\'sections\'] ) ? $get_settings[\'sections\'] : [];
/* settings array */
$settings = isset( $get_settings[\'settings\'] ) ? $get_settings[\'settings\'] : [];
/* build the Theme Options */
if ( function_exists( \'ot_register_settings\' ) && OT_USE_THEME_OPTIONS ) {
ot_register_settings(
[
[
\'id\' => \'option_tree\',
\'pages\' => [
[
\'id\' => \'ot_theme_options\',
\'parent_slug\' => apply_filters( \'ot_theme_options_parent_slug\', \'unite-welcome-page\' ),
\'page_title\' => apply_filters( \'ot_theme_options_page_title\', __( \'Theme Options\', \'option-tree\' ) ),
\'menu_title\' => apply_filters( \'ot_theme_options_menu_title\', __( \'Theme Options\', \'option-tree\' ) ),
\'capability\' => $caps = apply_filters( \'ot_theme_options_capability\', \'edit_theme_options\' ),
\'menu_slug\' => apply_filters( \'ot_theme_options_menu_slug\', \'ut_theme_options\' ),
\'icon_url\' => apply_filters( \'ot_theme_options_icon_url\', null ),
\'position\' => apply_filters( \'ot_theme_options_position\', null ),
\'updated_message\' => apply_filters( \'ot_theme_options_updated_message\', __( \'Theme Options updated.\', \'option-tree\' ) ),
\'reset_message\' => apply_filters( \'ot_theme_options_reset_message\', __( \'Theme Options reset.\', \'option-tree\' ) ),
\'button_text\' => apply_filters( \'ot_theme_options_button_text\', __( \'Save Changes\', \'option-tree\' ) ),
\'screen_icon\' => \'themes\',
\'sections\' => $sections,
\'settings\' => $settings,
],
],
],
]
);
// Filters the options.php to add the minimum user capabilities.
add_filter( \'option_page_capability_option_tree\', create_function( \'$caps\', "return \'$caps\';" ), 999 );
}
}
}
我知道add_filter
会变成现实add_filter( \'option_page_capability_option_tree\', function($caps) { return $caps; }, 999);