- This topic has 19 replies, 2 voices, and was last updated 8 years, 2 months ago by Tom.
-
AuthorPosts
-
January 1, 2016 at 11:25 pm #162842Pete
Hi Tom. Happy New Year. I have the error message at the bottom of my search results page using this plugin… https://wordpress.org/plugins/ultimate-wp-query-search-filter/. I’ve been using the plugin for some time without any error but it threw this error on an update a few months a go (I don’t know which one).
Warning: urlencode() expects parameter 1 to be string, array given in /home4/abc/public_html/xyz/wp-content/themes/generatepress/inc/template-tags.php on line 38
I’ll PM you website/link if you like.
Thanks, Pete.
January 2, 2016 at 12:58 am #162845TomLead DeveloperLead DeveloperHmm, so here’s the block the plugin is having trouble with:
$links = paginate_links( array( 'add_args' => array_map( 'urlencode', $query_args ), ) );
It’s a pretty standard piece of code when doing paginated links for your blog.
Does the author of that plugin have any idea why their code would cause a conflict with the above?
January 2, 2016 at 7:13 pm #163004PeteI’ll refer them to this post π
January 2, 2016 at 10:58 pm #163033TomLead DeveloperLead DeveloperCool – looking forward to figuring it out π
January 4, 2016 at 5:02 am #163238PeteThis was the plugin author’s answer…
https://wordpress.org/support/topic/urlencode-error-message?replies=2#post-7842553
January 4, 2016 at 6:56 am #163257PeteI made a
inc
folder in my child theme and copied thetemplate-tags.php
into this folder with the plugin author’s changes he proposed but it didn’t make any difference. In any case I think the issue is his plugin rather than your theme, so I shouldn’t really be editing the theme.January 4, 2016 at 10:31 am #163305TomLead DeveloperLead DeveloperThe piece of code I used there is quite popular – nothing fancy going on.
I’d be interested to know why the plugin isn’t compatible with it, even if it means I have to change something.
January 10, 2016 at 8:29 am #164768PeteOK, this issue only happens with the GP parent and my GP child theme. I tried it with 2012,2013,2014 and 2015 themes and they didn’t have the error.
January 10, 2016 at 11:34 am #164852TomLead DeveloperLead DeveloperThat’s because those themes don’t have paginated links for the blog.
Did the plugin author shed any light on why this may be happening?
January 10, 2016 at 11:37 am #164855PeteNope, here’s the WP support forum link… https://wordpress.org/support/topic/urlencode-error-message
January 10, 2016 at 11:42 am #164859PeteI tried it with this theme that also has pagination and it doesn’t throw the error…
January 10, 2016 at 11:46 am #164862TomLead DeveloperLead DeveloperTry adding this function to your site: https://gist.github.com/generatepress/11c0fb0eb9252ed26018
It removes the “trouble” code.
January 10, 2016 at 11:58 am #164865PeteI fixed it by commenting out line 38 in
template-tags.php
// 'add_args' => array_map( 'urlencode', $query_args ),
January 10, 2016 at 11:59 am #164866TomLead DeveloperLead DeveloperThat’ll work until you update the theme.
Adding the PHP I gave will do the same thing but allow you to update as well π
January 10, 2016 at 12:00 pm #164867PeteThanks Tom, works a treat π
- This reply was modified 8 years, 2 months ago by Pete.
-
AuthorPosts
- You must be logged in to reply to this topic.