• YITH WooCommerce Ajax Product Filter v4.3.0 (free version) has a protected function _content_template() in /yith-woocommerce-ajax-navigation/includes/elementor/class-yith-wcan-elementor-reset-button.php line 131 which is being reported by Elementor as being deprecated since version 2.9.0. Use Elementor\Controls_Stack::content_template() instead.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Iván Sosa

    (@ivansosa)

    Hi there,

    hope you are doing well ??

    It’s weird, since we have been checking the documentation of the Elementor Render Widget Template page, and they show it as _content_template().

    Let us know any news.

    Have a great day!

    • This reply was modified 3 years, 4 months ago by Iván Sosa.
    Thread Starter garak734

    (@garak734)

    Hi Iván,
    This is what is showing in the WordPress debug.log:

    [08-Nov-2021 14:18:09 UTC] PHP Deprecated:  _content_template is <strong>deprecated</strong> since version 2.9.0! Use Elementor\Controls_Stack::content_template() instead. in C:\wamp64\www\porto-demo.local\wordpress\wp-includes\functions.php on line 5211
    [08-Nov-2021 14:18:09 UTC] PHP Stack trace:
    [08-Nov-2021 14:18:09 UTC] PHP   1. {main}() C:\wamp64\www\porto-demo.local\wordpress\wp-admin\post.php:0
    [08-Nov-2021 14:18:09 UTC] PHP   2. require_once() C:\wamp64\www\porto-demo.local\wordpress\wp-admin\post.php:12
    [08-Nov-2021 14:18:09 UTC] PHP   3. do_action($hook_name = 'admin_action_elementor') C:\wamp64\www\porto-demo.local\wordpress\wp-admin\admin.php:408
    [08-Nov-2021 14:18:09 UTC] PHP   4. WP_Hook->do_action($args = [0 => '']) C:\wamp64\www\porto-demo.local\wordpress\wp-includes\plugin.php:470
    [08-Nov-2021 14:18:09 UTC] PHP   5. WP_Hook->apply_filters($value = '', $args = [0 => '']) C:\wamp64\www\porto-demo.local\wordpress\wp-includes\class-wp-hook.php:327
    [08-Nov-2021 14:18:09 UTC] PHP   6. Elementor\Core\Editor\Editor->init($die = '') C:\wamp64\www\porto-demo.local\wordpress\wp-includes\class-wp-hook.php:303
    [08-Nov-2021 14:18:09 UTC] PHP   7. Elementor\Core\Editor\Editor->print_editor_template() C:\wamp64\www\porto-demo.local\wordpress\wp-content\plugins\elementor\core\editor\editor.php:164
    [08-Nov-2021 14:18:09 UTC] PHP   8. include() C:\wamp64\www\porto-demo.local\wordpress\wp-content\plugins\elementor\core\editor\editor.php:323
    [08-Nov-2021 14:18:09 UTC] PHP   9. wp_footer() C:\wamp64\www\porto-demo.local\wordpress\wp-content\plugins\elementor\includes\editor-templates\editor-wrapper.php:71
    [08-Nov-2021 14:18:09 UTC] PHP  10. do_action($hook_name = 'wp_footer') C:\wamp64\www\porto-demo.local\wordpress\wp-includes\general-template.php:3031
    [08-Nov-2021 14:18:09 UTC] PHP  11. WP_Hook->do_action($args = [0 => '']) C:\wamp64\www\porto-demo.local\wordpress\wp-includes\plugin.php:470
    [08-Nov-2021 14:18:09 UTC] PHP  12. WP_Hook->apply_filters($value = '', $args = [0 => '']) C:\wamp64\www\porto-demo.local\wordpress\wp-includes\class-wp-hook.php:327
    [08-Nov-2021 14:18:09 UTC] PHP  13. Elementor\Core\Editor\Editor->wp_footer('') C:\wamp64\www\porto-demo.local\wordpress\wp-includes\class-wp-hook.php:303
    [08-Nov-2021 14:18:09 UTC] PHP  14. Elementor\Widgets_Manager->render_widgets_content() C:\wamp64\www\porto-demo.local\wordpress\wp-content\plugins\elementor\core\editor\editor.php:830
    [08-Nov-2021 14:18:09 UTC] PHP  15. Elementor\Controls_Stack->print_template() C:\wamp64\www\porto-demo.local\wordpress\wp-content\plugins\elementor\includes\managers\widgets.php:385
    [08-Nov-2021 14:18:09 UTC] PHP  16. Elementor\Modules\DevTools\Deprecation->deprecated_function($function = '_content_template', $version = '2.9.0', $replacement = 'Elementor\\Controls_Stack::content_template()', $base_version = *uninitialized*) C:\wamp64\www\porto-demo.local\wordpress\wp-content\plugins\elementor\includes\base\controls-stack.php:1891
    [08-Nov-2021 14:18:09 UTC] PHP  17. _deprecated_function($function = '_content_template', $version = '2.9.0', $replacement = 'Elementor\\Controls_Stack::content_template()') C:\wamp64\www\porto-demo.local\wordpress\wp-content\plugins\elementor\modules\dev-tools\deprecation.php:239
    [08-Nov-2021 14:18:09 UTC] PHP  18. trigger_error($message = '_content_template is <strong>deprecated</strong> since version 2.9.0! Use Elementor\\Controls_Stack::content_template() instead.', $error_type = 16384) C:\wamp64\www\porto-demo.local\wordpress\wp-includes\functions.php:5211

    I am running WordPress 5.8.1, Elementor 3.4.7 and YITH WooCommerce Ajax Product Filter 4.3.0

    The function is in in yith-woocommerce-ajax-navigation/includes/elementor/class-yith-wcan-elementor-reset-button.php :

    protected function _content_template() { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore
    			$frontend = new YITH_WCAN_Frontend();
    
    			$_GET['min_price']     = 10;
    			$_GET['max_price']     = 100;
    			$_GET['onsale_filter'] = 1;
    
    			$_REQUEST[ YITH_WCAN_Query()->get_query_param() ] = 1;
    
    			$frontend->reset_button();
    		}

    If I rename or comment out the whole function, the Deprecated message is not reported.

    I do not have any other plugins/PHP code with ‘_content_template’ in the code.

    Hope that helps track down the issue.

    Thanks

    Alan

    Plugin Support crodriguez1991

    (@crodriguez1991)

    Hello there,

    I hope you’re doing well ??

    We checked and found Elementor deprecated this method and we fixed it.

    Please, download and replace the following file in the following path:

    wp-content/plugins/yith-woocommerce-ajax-navigation/includes/elementor/class-yith-wcan-elementor-reset-button.php

    Please, try it and let me know.

    Have a good day.

    Thread Starter garak734

    (@garak734)

    Hi,
    Now running WordPress 5.9, Elementor 3.3.5 and Elementor Pro 3.6.1 with the Free version of YITH WooCommerce Ajax Product Filter 4.7.0

    Still getting entry in debug.log when I use Elementor to edit anything:

    [17-Feb-2022 12:17:57 UTC] PHP Deprecated:  _content_template is <strong>deprecated</strong> since version 2.9.0! Use Elementor\Controls_Stack::content_template() instead. in \wordpress\wp-includes\functions.php on line 5211
    [17-Feb-2022 12:17:57 UTC] PHP Stack trace:
    [17-Feb-2022 12:17:57 UTC] PHP   1. {main}() \wordpress\wp-admin\post.php:0
    [17-Feb-2022 12:17:57 UTC] PHP   2. require_once() \wordpress\wp-admin\post.php:12
    [17-Feb-2022 12:17:57 UTC] PHP   3. do_action($hook_name = 'admin_action_elementor') \wordpress\wp-admin\admin.php:408
    [17-Feb-2022 12:17:57 UTC] PHP   4. WP_Hook->do_action($args = [0 => '']) \wordpress\wp-includes\plugin.php:470
    [17-Feb-2022 12:17:57 UTC] PHP   5. WP_Hook->apply_filters($value = '', $args = [0 => '']) \wordpress\wp-includes\class-wp-hook.php:327
    [17-Feb-2022 12:17:57 UTC] PHP   6. Elementor\Core\Editor\Editor->init($die = '') \wordpress\wp-includes\class-wp-hook.php:303
    [17-Feb-2022 12:17:57 UTC] PHP   7. Elementor\Core\Editor\Editor->print_editor_template() \wordpress\wp-content\plugins\elementor\core\editor\editor.php:158
    [17-Feb-2022 12:17:57 UTC] PHP   8. include() \wordpress\wp-content\plugins\elementor\core\editor\editor.php:317
    [17-Feb-2022 12:17:57 UTC] PHP   9. wp_footer() \wordpress\wp-content\plugins\elementor\includes\editor-templates\editor-wrapper.php:71
    [17-Feb-2022 12:17:57 UTC] PHP  10. do_action($hook_name = 'wp_footer') \wordpress\wp-includes\general-template.php:3031
    [17-Feb-2022 12:17:57 UTC] PHP  11. WP_Hook->do_action($args = [0 => '']) \wordpress\wp-includes\plugin.php:470
    [17-Feb-2022 12:17:57 UTC] PHP  12. WP_Hook->apply_filters($value = '', $args = [0 => '']) \wordpress\wp-includes\class-wp-hook.php:327
    [17-Feb-2022 12:17:57 UTC] PHP  13. Elementor\Core\Editor\Editor->wp_footer('') \wordpress\wp-includes\class-wp-hook.php:303
    [17-Feb-2022 12:17:57 UTC] PHP  14. Elementor\Widgets_Manager->render_widgets_content() \wordpress\wp-content\plugins\elementor\core\editor\editor.php:824
    [17-Feb-2022 12:17:57 UTC] PHP  15. Elementor\Controls_Stack->print_template() \wordpress\wp-content\plugins\elementor\includes\managers\widgets.php:452
    [17-Feb-2022 12:17:57 UTC] PHP  16. Elementor\Modules\DevTools\Deprecation->deprecated_function($function = '_content_template', $version = '2.9.0', $replacement = 'Elementor\\Controls_Stack::content_template()', $base_version = *uninitialized*) \wordpress\wp-content\plugins\elementor\includes\base\controls-stack.php:1929
    [17-Feb-2022 12:17:57 UTC] PHP  17. _deprecated_function($function = '_content_template', $version = '2.9.0', $replacement = 'Elementor\\Controls_Stack::content_template()') \wordpress\wp-content\plugins\elementor\modules\dev-tools\deprecation.php:239
    [17-Feb-2022 12:17:57 UTC] PHP  18. trigger_error($message = '_content_template is <strong>deprecated</strong> since version 2.9.0! Use Elementor\\Controls_Stack::content_template() instead.', $error_type = 16384) \wordpress\wp-includes\functions.php:5211

    I have edited /yith-woocommerce-ajax-navigation/includes/elementor/class-yith-wcan-elementor-reset-button.php and changed line [134] to protected function content_template() and this works.

    Just change _content_template() to content_template() – without the leading ‘_’ underscore.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Deprecated _content_template reported by Elementor’ is closed to new replies.