Hi,
id like to report a bug in wp views. I was busy with a website for my own project in which i wanted to use a plugin called 'https://wordpress.org/support/plugin/worth-the-read/'. However this plugin gave errors with a hook that hooked into the title. It expects 2 parameters which it does not get.
I let my php developer take a look at the issue and he concluded that the problem resides in: wp-views/embedded/inc/wpv-shortcodes.php
He gave the following comment:
In two places apply_filters is being called on 'the_title'. Only one parameter is given where it expects two.
He says any other function/plugin that will hook into the title will give problems with views because of this.
I also have the callstack:
Warning: Missing argument 2 for wtr_filter_title() in C:\wamp\public_html\blogsite\wp-content\plugins\worth-the-read\worth-the-read.php on line 174
Call Stack
# Time Memory Function Location
1 0.0005 245352 {main}( ) ..\index.php:0
2 0.0009 248456 require( 'C:\wamp\public_html\blogsite\wp-blog-header.php' ) ..\index.php:17
3 1.0843 92426288 require_once( 'C:\wamp\public_html\blogsite\wp-includes\template-loader.php' ) ..\wp-blog-header.php:19
4 1.0917 92848584 include( 'C:\wamp\public_html\blogsite\wp-content\themes\blogsite\page.php' ) ..\template-loader.php:74
5 1.2066 99991880 the_content( ) ..\page.php:28
6 1.2071 99994152 apply_filters( ) ..\post-template.php:240
7 1.2071 99996152 WP_Hook->apply_filters( ) ..\plugin.php:203
8 1.2167 100229328 call_user_func_array:{C:\wamp\public_html\blogsite\wp-includes\class-wp-hook.php:286} ( ) ..\class-wp-hook.php:286
9 1.2167 100229648 do_shortcode( ) ..\class-wp-hook.php:286
10 1.2171 100236096 preg_replace_callback ( ) ..\shortcodes.php:197
11 1.2258 100252224 do_shortcode_tag( ) ..\shortcodes.php:197
12 1.2259 100252704 call_user_func:{C:\wamp\public_html\blogsite\wp-includes\shortcodes.php:319} ( ) ..\shortcodes.php:319
13 1.2259 100253032 WP_Views->short_tag_wpv_view( ) ..\shortcodes.php:319
14 1.2333 100272568 WP_Views->render_view_ex( ) ..\wpv.class.php:628
15 1.2333 100275552 WP_Views->render_view( ) ..\wpv.class.php:1985
16 1.2752 100417760 wpv_do_shortcode( ) ..\wpv.class.php:2233
17 1.2758 100418168 do_shortcode( ) ..\wpv-shortcodes.php:7104
18 1.2760 100423224 preg_replace_callback ( ) ..\shortcodes.php:197
19 1.2760 100425832 do_shortcode_tag( ) ..\shortcodes.php:197
20 1.2760 100426008 call_user_func:{C:\wamp\public_html\blogsite\wp-includes\shortcodes.php:319} ( ) ..\shortcodes.php:319
21 1.2761 100426048 wpv_shortcode_wpv_post_link( ) ..\shortcodes.php:319
22 1.2769 100428008 apply_filters( ) ..\wpv-shortcodes.php:2667
23 1.2769 100428472 WP_Hook->apply_filters( ) ..\plugin.php:203
24 1.2771 100429672 call_user_func_array:{C:\wamp\public_html\blogsite\wp-includes\class-wp-hook.php:286} ( ) ..\class-wp-hook.php:286
25 1.2771 100429992 wtr_filter_title( ) ..\class-wp-hook.php:286
Could you look into the problem and hopefully fix this in a future release?
Thank you
I assume you mean worth-the-read.1.3.3
I installed that plugin and added the ShortCode "[wpv-post-title]" to the Body, as well as activated Toolset Views, Types and the Plugin you mention.
In the Front end I see that The ShortCode is not executed, instead it fails with
Fatal error: Uncaught ArgumentCountError: Too few arguments to function wtr_filter_title(), 1 passed in .../wp-includes/class-wp-hook.php on line 286 and exactly 2 expected in .../plugins/worth-the-read/worth-the-read.php on line 172
and
ArgumentCountError: Too few arguments to function wtr_filter_title(), 1 passed in .../wp-includes/class-wp-hook.php on line 286 and exactly 2 expected in .../plugins/worth-the-read/worth-the-read.php on line 172
I do not think this is on Toolset thou, to me it seems that plugin should set default values to the $variables it uses as arguments, for example to use "wtr_filter_title( $title, $post_id = null )" instead of "function wtr_filter_title( $title, $post_id ) {" as now.
But I am not sure about this, I will escalate this problem to the developers to have a look at it.
I will update you ASAP
Ok thank you very much. I look forward to hearing more.
Hi,
I Just wanted to let you know that i have run into another issue that i think has the same orgin. I was creating a view from an imported rss feed. When i want to output the posts i get an error. If i remove the title form the view, the message is gone.
Warning: Missing argument 2 for com\cminds\rssimporter\plugin\controllers\FeedController::com\cminds\rssimporter\plugin\controllers\{closure}() in C:\wamp\public_html\studiumgenerale\wp-content\plugins\cm-rss-importer-pro\plugin\controllers\FeedController.php on line 162
Call Stack
# Time Memory Function Location
1 0.0004 246072 {main}( ) ..\index.php:0
2 0.0007 249216 require( 'C:\wamp\public_html\studiumgenerale\wp-blog-header.php' ) ..\index.php:17
3 1.8554 109371528 require_once( 'C:\wamp\public_html\studiumgenerale\wp-includes\template-loader.php' ) ..\wp-blog-header.php:19
4 1.8645 109833560 include( 'C:\wamp\public_html\studiumgenerale\wp-content\themes\studiumgenerales\page-agenda.php' ) ..\template-loader.php:74
5 1.9584 113171400 the_content( ) ..\page-agenda.php:25
6 1.9605 113172400 apply_filters( ) ..\post-template.php:240
7 1.9605 113172864 WP_Hook->apply_filters( ) ..\plugin.php:203
8 1.9709 113419264 call_user_func_array:{C:\wamp\public_html\studiumgenerale\wp-includes\class-wp-hook.php:286} ( ) ..\class-wp-hook.php:286
9 1.9709 113419584 do_shortcode( ) ..\class-wp-hook.php:286
10 1.9713 113424024 preg_replace_callback ( ) ..\shortcodes.php:197
11 1.9713 113425816 do_shortcode_tag( ) ..\shortcodes.php:197
12 1.9714 113426440 call_user_func:{C:\wamp\public_html\studiumgenerale\wp-includes\shortcodes.php:319} ( ) ..\shortcodes.php:319
13 1.9714 113426768 WP_Views->short_tag_wpv_view( ) ..\shortcodes.php:319
14 1.9820 113445720 WP_Views->render_view_ex( ) ..\wpv.class.php:628
15 1.9820 113448704 WP_Views->render_view( ) ..\wpv.class.php:1985
16 2.0384 113883304 wpv_do_shortcode( ) ..\wpv.class.php:2233
17 2.0395 113883800 do_shortcode( ) ..\wpv-shortcodes.php:7104
18 2.0398 113888672 preg_replace_callback ( ) ..\shortcodes.php:197
19 2.0399 113890808 do_shortcode_tag( ) ..\shortcodes.php:197
20 2.0399 113890984 call_user_func:{C:\wamp\public_html\studiumgenerale\wp-includes\shortcodes.php:319} ( ) ..\shortcodes.php:319
21 2.0399 113891120 wpv_shortcode_wpv_post_title( ) ..\shortcodes.php:319
22 2.0400 113893128 apply_filters( ) ..\wpv-shortcodes.php:2557
23 2.0400 113893592 WP_Hook->apply_filters( ) ..\plugin.php:203
24 2.0401 113894792 call_user_func_array:{C:\wamp\public_html\studiumgenerale\wp-includes\class-wp-hook.php:286} ( ) ..\class-wp-hook.php:286
25 2.0402 113895112 com\cminds\rssimporter\plugin\controllers\FeedController->com\cminds\rssimporter\plugin\controllers\{closure}( ) ..\class-wp-hook.php:286
We debugged this and filed it in our Compatibility issue tracker, where a developer will try to contact the Plugin Author and suggest the fix proposed.
This problem is due to a missing fallback to the argument if not provided.
ook thank you for the update. Kind regards,
Glenn
Hi Glenn,
This issue should be fixed in the Types release 2.2.23.
There is an errata published for the issue here: https://toolset.com/errata/missing-id-argument-when-the-the_title-hook-is-applied/
If you want a temporary fix for the issue until we launch Types 2.2.23 , Please follow the stes mentioned in the errata.
Thanks.