- This topic has 19 replies, 2 voices, and was last updated 10 years, 2 months ago by
Tom.
-
AuthorPosts
-
January 1, 2016 at 11:25 pm #162842
Pete
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 38I’ll PM you website/link if you like.
Thanks, Pete.
January 2, 2016 at 12:58 am #162845Tom
Lead 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 #163004Pete
I’ll refer them to this post 🙂
January 2, 2016 at 10:58 pm #163033Tom
Lead DeveloperLead DeveloperCool – looking forward to figuring it out 🙂
January 4, 2016 at 5:02 am #163238Pete
This 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 #163257Pete
I made a
incfolder in my child theme and copied thetemplate-tags.phpinto 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 #163305Tom
Lead 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 #164768Pete
OK, 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 #164852Tom
Lead 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 #164855Pete
Nope, here’s the WP support forum link… https://wordpress.org/support/topic/urlencode-error-message
January 10, 2016 at 11:42 am #164859Pete
I tried it with this theme that also has pagination and it doesn’t throw the error…
January 10, 2016 at 11:46 am #164862Tom
Lead 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 #164865Pete
I 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 #164866Tom
Lead 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 #164867Pete
Thanks Tom, works a treat 🙂
-
This reply was modified 10 years, 2 months ago by
Pete.
-
This reply was modified 10 years, 2 months ago by
-
AuthorPosts
- You must be logged in to reply to this topic.