Title: [Plugin: Restrict Categories] Error when using plugin&#8230;
Last modified: August 19, 2016

---

# [Plugin: Restrict Categories] Error when using plugin…

 *  Resolved [Peja](https://wordpress.org/support/users/peja1389/)
 * (@peja1389)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-restrict-categories-error-when-using-plugin/)
 * I get this for every category on the edit screen.
 * > Warning: in_array() [function.in-array]: Wrong datatype for second argument
   > in /home/mysite/public_html/wp-content/plugins/restrict-categories/restrict-
   > categories.php on line 204

Viewing 15 replies - 1 through 15 (of 22 total)

1 [2](https://wordpress.org/support/topic/plugin-restrict-categories-error-when-using-plugin/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/plugin-restrict-categories-error-when-using-plugin/page/2/?output_format=md)

 *  Plugin Author [Matthew Muro](https://wordpress.org/support/users/mmuro/)
 * (@mmuro)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-restrict-categories-error-when-using-plugin/#post-1777120)
 * Some have reported that selecting a category and saving fixes this.
 * If not, I’m working on some updates and will hopefully get them released soon.
 *  [misthero](https://wordpress.org/support/users/misthero/)
 * (@misthero)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-restrict-categories-error-when-using-plugin/#post-1777291)
 * exact same problem here just after installing the plugin the very first time 
   on a new wordpress site.
 * the error is shown next to every unchecked checkbox, if you chack it the error
   is gone for that checkbox, anyway the plugin doesn’t work. No category is restricted.
 * Thank you for the support
 *  Plugin Author [Matthew Muro](https://wordpress.org/support/users/mmuro/)
 * (@mmuro)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-restrict-categories-error-when-using-plugin/#post-1777292)
 * I just pushed out Version 1.3 that hopefully fixes this error.
 * [@misthero](https://wordpress.org/support/users/misthero/): can you provide me
   the PHP version you are running (eg. 5.2.1, 5.3.2)?
 *  [misthero](https://wordpress.org/support/users/misthero/)
 * (@misthero)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-restrict-categories-error-when-using-plugin/#post-1777293)
 * Thank you for your answer,
 * I just udpdated but:
 *     ```
       Downloading update from http://downloads.wordpress.org/plugin/restrict-categories.1.3.zip…
   
       Unpacking the update…
   
       Installing the latest version…
   
       Deactivating the plugin…
   
       Removing the old version of the plugin…
   
       Plugin upgraded successfully.
   
       Reactivating the plugin…
   
       Warning: Invalid argument supplied for foreach() in /home/www/test-site/public_html/wp-content/plugins/restrict-categories/restrict-categories.php on line 277
       ```
   
 * I see this error on top of every page in the dashboard now….
 * PHP Version 5.2.6-1+lenny9
 * I tried to disable every plugin but restrict categories, no good.
 * anyway the previous error is gone, still no gategory restricted.
 * Thank you again.
 *  Plugin Author [Matthew Muro](https://wordpress.org/support/users/mmuro/)
 * (@mmuro)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-restrict-categories-error-when-using-plugin/#post-1777295)
 * Hmm…
 * You shouldn’t be getting an error on that line. The only reason you’d be getting
   that error is if get_user_meta is not returning an array.
 * Can you add `var_dump($user_cap);` right before line 277 and tell me what it 
   outputs?
 * Also, you may want to download a fresh copy of the plugin again.
 *  [misthero](https://wordpress.org/support/users/misthero/)
 * (@misthero)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-restrict-categories-error-when-using-plugin/#post-1777296)
 * Tis is what I get adding that line
 *     ```
       string(0) ""
       Warning: Invalid argument supplied for foreach() in /home/www/test-site/public_html/wp-content/plugins/restrict-categories/restrict-categories.php on line 279
       ```
   
 * Like I said is a fresh installation with untouched wordpress running Twentyten
   theme, I’ll try deleting and uploading the plugin manually and let you know what
   happens.
 *  [misthero](https://wordpress.org/support/users/misthero/)
 * (@misthero)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-restrict-categories-error-when-using-plugin/#post-1777297)
 * ok, deleted the plugin , uploaded again via ftp and activated, the error is still
   there…
 * If you want me to try anything else I’m here.
 * Thank you again
 *  Plugin Author [Matthew Muro](https://wordpress.org/support/users/mmuro/)
 * (@mmuro)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-restrict-categories-error-when-using-plugin/#post-1777298)
 * For some reason, get_user_meta is returning an empty string. What version of 
   WordPress are you running?
 *  [misthero](https://wordpress.org/support/users/misthero/)
 * (@misthero)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-restrict-categories-error-when-using-plugin/#post-1777302)
 * oh sorry, I went to sleep, the wordpress version is the last, 3.0.1 english languange,
   the theme is twentyten,it is a test server, I’m testing some functionalities 
   I want to include in a real theme, if it’s important the istallation for now 
   includes just 6 users I created for testing a 2 categories.
 * if you want I can give you access to the dashboard, no problem for me if you 
   have some spare time..
 * Thank you.
 *  Plugin Author [Matthew Muro](https://wordpress.org/support/users/mmuro/)
 * (@mmuro)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-restrict-categories-error-when-using-plugin/#post-1777304)
 * How comfortable are you with MySQL?
 * If you can use phpMyAdmin or something similar to access your database, open 
   the `wp_usermeta` table and find the `wp_capabilities` entries under the `meta_key`
   column. You should have one for each user role. Paste in one of the `meta_value`
   here. It’ll look something like this: `a:1:{s:13:"administrator";s:1:"1";}`
 *  [misthero](https://wordpress.org/support/users/misthero/)
 * (@misthero)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-restrict-categories-error-when-using-plugin/#post-1777305)
 * Hi Matthew,
 * I have 2 roles set up right now, the meta values are:
 * `a:1:{s:13:"administrator";s:1:"1";}`
    for the default admin
 * `a:1:{s:11:"contributor";s:1:"1";}`
    for the 6 contributors i created
 * but now looking at the database one thing maybe you should know, in this database
   the prefix is not “wp_” many of us change the default table prefix inside config.
   php file
 * in my case the prefix is “test_” because I specified the var:
    `$table_prefix
   = 'test_';` in config.php
 * so I do not have _wp\_usermeta_ nor _wp\_capabilities_ but
    but _test\_usermeta_
   and _test\_capabilities_, and so on…
 * Could this be the problem with the plugin??
 * Thank you.
 *  Plugin Author [Matthew Muro](https://wordpress.org/support/users/mmuro/)
 * (@mmuro)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-restrict-categories-error-when-using-plugin/#post-1777306)
 * Is the meta_key called `wp_capabilities`?
 *  Plugin Author [Matthew Muro](https://wordpress.org/support/users/mmuro/)
 * (@mmuro)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-restrict-categories-error-when-using-plugin/#post-1777307)
 * I’m sorry, I should have read your response more carefully.
 * Yes, that seems to be the problem with the plugin on your server. I’m able to
   reproduce the error.
 * A short term fix will be to change line 275 from `$user_cap = get_user_meta( 
   $current_user->ID, 'wp_capabilities', true );` to `$user_cap = get_user_meta(
   $current_user->ID, 'test_capabilities', true );`.
 * I will work on getting a permanent fix online if you want to wait for the official
   download, though.
 *  [misthero](https://wordpress.org/support/users/misthero/)
 * (@misthero)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-restrict-categories-error-when-using-plugin/#post-1777308)
 * nope, is `test_capabilities`
 * as a side note I tried the bad way :p
 * changing any istance of `wp_capabilities` in the plugin with `test_capabilities`,
   the plugin seem to start working, it restrict categories, but I get another error:
 * `Warning: Invalid argument supplied for foreach() in /home/www/test-site/public_html/
   wp-content/plugins/restrict-categories/restrict-categories.php on line 280`
 * Line280:
    `foreach ( $settings[$key . '_cats'] as $category ) {`
 * maybe mine is not the best solution…
 * edit: sorry I wrote while you where posting
 *  Plugin Author [Matthew Muro](https://wordpress.org/support/users/mmuro/)
 * (@mmuro)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-restrict-categories-error-when-using-plugin/#post-1777309)
 * Cool.
 * I pushed out a fix for that other error you are getting yesterday right around
   the time I told you to grab a fresh copy. You may want to try that again and 
   reapply the test_capabilities fix.
 * Sorry for all the trouble, but you are helping make it a better plugin 🙂

Viewing 15 replies - 1 through 15 (of 22 total)

1 [2](https://wordpress.org/support/topic/plugin-restrict-categories-error-when-using-plugin/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/plugin-restrict-categories-error-when-using-plugin/page/2/?output_format=md)

The topic ‘[Plugin: Restrict Categories] Error when using plugin…’ is closed to 
new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/restrict-categories.svg)
 * [Restrict Categories](https://wordpress.org/plugins/restrict-categories/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/restrict-categories/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/restrict-categories/)
 * [Active Topics](https://wordpress.org/support/plugin/restrict-categories/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/restrict-categories/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/restrict-categories/reviews/)

 * 22 replies
 * 3 participants
 * Last reply from: [Matthew Muro](https://wordpress.org/support/users/mmuro/)
 * Last activity: [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-restrict-categories-error-when-using-plugin/page/2/#post-1777317)
 * Status: resolved