Title: [Plugin: Better Related Posts] Embedcode post causing: &#039;Warning: array_keys()&#039;
Last modified: August 20, 2016

---

# [Plugin: Better Related Posts] Embedcode post causing: 'Warning: array_keys()'

 *  [Twansparant](https://wordpress.org/support/users/twansparant/)
 * (@twansparant)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-better-related-posts-embedcode-post-causing-warning-array_keys/)
 * Hi there,
 * I’m getting some weird PHP warnings with the **better-related-posts** plugin:
   [http://wordpress.org/extend/plugins/better-related/](http://wordpress.org/extend/plugins/better-related/)
   but only on **ONE particular post**.
 * I have been using the plugin without any problems for some months now, but all
   of sudden these warnings showed up on my single template:
 *     ```
       Warning: array_keys() [function.array-keys]: The first argument should be an array in /path-to/single.php on line 69
   
       Warning: array_slice() expects parameter 1 to be array, null given in /path-to/single.php on line 69
   
       Warning: array_search() [function.array-search]: Wrong datatype for second argument in /path-to/single.php on line 79
       ```
   
 * etc.
 * However, the related posts DO show up underneath these warnings with my custom
   query like this: [http://pastebin.com/JacTv2mZ](http://pastebin.com/JacTv2mZ)
   (
   line 69 from the warnings is line 2 in pastebin)
 * So I tried to pindown the problem and it seems it’s only occuring when there 
   is a **<object>** embedding in the post content like a soundcloud player in my
   case.
 * If I replace this original soundcloud embedcode with a shortcode (using [this plugin](http://wordpress.org/extend/plugins/soundcloud-shortcode/)):
   `[
   soundcloud params="player_type=tiny&color=006F9F" height="18"]http://soundcloud.
   com/trackname[/soundcloud]` the warnings are gone.
 * My guess is that this embeddingcode is being included in the MySQL Fulltext Search
   and causing problems, but I think it should be excluded?
 * Does anyone have similar problems or have a solution or workaround for my problem?
   Any help is appreciated!
 * Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Thread Starter [Twansparant](https://wordpress.org/support/users/twansparant/)
 * (@twansparant)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-better-related-posts-embedcode-post-causing-warning-array_keys/#post-2399335)
 * Even with the new HTML5 soundcloud code using iframes the problem occurs.
 *  [blackbookdesign](https://wordpress.org/support/users/blackbookdesign/)
 * (@blackbookdesign)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-better-related-posts-embedcode-post-causing-warning-array_keys/#post-2399628)
 * Did you find a solution for this?
    I have the same problem… thx.
 *  Thread Starter [Twansparant](https://wordpress.org/support/users/twansparant/)
 * (@twansparant)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-better-related-posts-embedcode-post-causing-warning-array_keys/#post-2399629)
 * No unfortunately not yet…
    I have a workaround though to check if **$scores**
   returns an array, if not I use the normal **the_related** [http://pastebin.com/TSCn9aRR](http://pastebin.com/TSCn9aRR)
 * I allready addressed the issue to the plugin author here:
    [http://www.nicolaskuttler.com/wordpress-plugin/wordpress-related-posts-plugin/#comment-22566](http://www.nicolaskuttler.com/wordpress-plugin/wordpress-related-posts-plugin/#comment-22566)
 *  [blackbookdesign](https://wordpress.org/support/users/blackbookdesign/)
 * (@blackbookdesign)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-better-related-posts-embedcode-post-causing-warning-array_keys/#post-2399630)
 * Great. Thanks for the hint.
 * On my side I’ve found a sneakier way to “mask” the bug.
    I actually turned off
   the php errors display in the wp-config. SInce I was pushing the site into production
   I needed a quick solution. While it will makes the error log grow, it still make
   it a viable solution. + it still shows the other related while clearing the array
   slice error. if interested:
 *     ```
       error_reporting(0);
       @ini_set('display_errors', 0);
       ```
   
 * On my side the error was done using the integrated WP embed for youtube.
 * Cheers.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘[Plugin: Better Related Posts] Embedcode post causing: 'Warning: array_keys()'’
is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/better-related.svg)
 * [Better Related Posts](https://wordpress.org/plugins/better-related/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/better-related/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/better-related/)
 * [Active Topics](https://wordpress.org/support/plugin/better-related/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/better-related/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/better-related/reviews/)

## Tags

 * [array keys](https://wordpress.org/support/topic-tag/array-keys/)
 * [PHP Warning](https://wordpress.org/support/topic-tag/php-warning/)

 * 4 replies
 * 2 participants
 * Last reply from: [blackbookdesign](https://wordpress.org/support/users/blackbookdesign/)
 * Last activity: [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-better-related-posts-embedcode-post-causing-warning-array_keys/#post-2399630)
 * Status: not resolved