This theme I was handed from another dev company is littered with add_action/filter( 'hook/filter', create_function( '', 'return blah('blah')' );
We will be moving this site to a server running php 7.2
.
I am wondering what's the appropriate method to remove these actions and filters. Or can I simply just copy and paste the /path/to/file in the child directory and know that this will be overwritten?
Here's an example
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 );
}
}
}
I'm aware the appropriate add_filter
would come out to being add_filter( 'option_page_capability_option_tree', function($caps) { return $caps; }, 999);
create_function
is going to be removed in a future PHP version, that part has nothing to do with WordPress, see stackoverflow.com/questions/48161526/…