Closed. This question is off-topic. It is not currently accepting answers.admin管理员组文章数量:1322351
Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 4 years ago.
Improve this questionOur WP Debug is report that 'Function create_function() is deprecated'. Any idea how to rewrite this code to not include create_function ?
self::register_form_init_scripts( $form, $field_values, $ajax );
if ( apply_filters( 'gform_init_scripts_footer', false ) ) {
add_action( 'wp_footer', create_function( '', 'GFFormDisplay::footer_init_scripts(' . $form['id'] . ');' ), 20 );
add_action( 'gform_preview_footer', create_function( '', 'GFFormDisplay::footer_init_scripts(' . $form['id'] . ');' ) );
}
Closed. This question is off-topic. It is not currently accepting answers.
Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 4 years ago.
Improve this questionOur WP Debug is report that 'Function create_function() is deprecated'. Any idea how to rewrite this code to not include create_function ?
self::register_form_init_scripts( $form, $field_values, $ajax );
if ( apply_filters( 'gform_init_scripts_footer', false ) ) {
add_action( 'wp_footer', create_function( '', 'GFFormDisplay::footer_init_scripts(' . $form['id'] . ');' ), 20 );
add_action( 'gform_preview_footer', create_function( '', 'GFFormDisplay::footer_init_scripts(' . $form['id'] . ');' ) );
}
Share
Improve this question
asked Sep 17, 2020 at 16:43
user3217495user3217495
1032 bronze badges
1
|
1 Answer
Reset to default 2You no longer need to use create_function
you can instead just use an anonymous function:
add_action( 'gform_preview_footer', create_function( '', 'GFFormDisplay::footer_init_scripts(' . $form['id'] . ');' ) );
Should be:
add_action( 'gform_preview_footer', function() use ($form){
GFFormDisplay::footer_init_scripts($form['id']);
});
https://www.php/manual/en/functions.anonymous.php
本文标签: phpError39createfunction is deprecated39
版权声明:本文标题:php - Error - 'create_function is deprecated' 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742114467a2421403.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
GFFormDisplay::footer_init
there? what is the minimum php version you require? – Sisir Commented Sep 17, 2020 at 17:35