Title: in_array(): Argument #2 ($haystack) must be of type array, string given
Last modified: March 10, 2026

---

# in_array(): Argument #2 ($haystack) must be of type array, string given

 *  Resolved [alantygel2](https://wordpress.org/support/users/alantygel2/)
 * (@alantygel2)
 * [2 months, 4 weeks ago](https://wordpress.org/support/topic/in_array-argument-2-haystack-must-be-of-type-array-string-given/)
 * Hi,
 * I use mainwp dashboard in several websites, but a few of them are broken after
   the latest updates.
 * Particularly, I’m getting the following error when saving a Post:
 * {“code”:”internal_server_error”,”message”:”
   H\u00e1 um erro cr\u00edtico no seu
   site.<\/p>Saiba mais sobre a como resolver problemas do WordPress.<\/a><\/p>”,”
   data”:{“status”:500,”error”:{“type”:1,”message”:”Uncaught TypeError: in_array():
   Argument #2 ($haystack) must be of type array, string given in \/home\/socialor\/
   public_html\/wp-content\/plugins\/mainwp-child\/modules\/changes-logs\/classes\/
   class-changes-handle-wp-content.php:128\nStack trace:\n#0 \/home\/socialor\/public_html\/
   wp-content\/plugins\/mainwp-child\/modules\/changes-logs\/classes\/class-changes-
   handle-wp-content.php(128): in_array()\n#1 \/home\/socialor\/public_html\/wp-
   includes\/class-wp-hook.php(341): MainWP\Child\Changes\Changes_Handle_WP_Content::
   change_before_post_edit_data()\n#2 \/home\/socialor\/public_html\/wp-includes\/
   class-wp-hook.php(365): WP_Hook->apply_filters()\n#3 \/home\/socialor\/public_html\/
   wp-includes\/plugin.php(522): WP_Hook->do_action()\n#4 \/home\/socialor\/public_html\/
   wp-includes\/post.php(4901): do_action()\n#5 \/home\/socialor\/public_html\/wp-
   includes\/post.php(5296): wp_insert_post()\n#6 \/home\/socialor\/public_html\/
   wp-includes\/rest-api\/endpoints\/class-wp-rest-posts-controller.php(977): wp_update_post()\
   n#7 \/home\/socialor\/public_html\/wp-includes\/rest-api\/class-wp-rest-server.
   php(1292): WP_REST_Posts_Controller->update_item()\n#8 \/home\/socialor\/public_html\/
   wp-includes\/rest-api\/class-wp-rest-server.php(1125): WP_REST_Server->respond_to_request()\
   n#9 \/home\/socialor\/public_html\/wp-includes\/rest-api\/class-wp-rest-server.
   php(439): WP_REST_Server->dispatch()\n#10 \/home\/socialor\/public_html\/wp-includes\/
   rest-api.php(467): WP_REST_Server->serve_request()\n#11 \/home\/socialor\/public_html\/
   wp-includes\/class-wp-hook.php(341): rest_api_loaded()\n#12 \/home\/socialor\/
   public_html\/wp-includes\/class-wp-hook.php(365): WP_Hook->apply_filters()\n#
   13 \/home\/socialor\/public_html\/wp-includes\/plugin.php(570): WP_Hook->do_action()\
   n#14 \/home\/socialor\/public_html\/wp-includes\/class-wp.php(418): do_action_ref_array()\
   n#15 \/home\/socialor\/public_html\/wp-includes\/class-wp.php(821): WP->parse_request()\
   n#16 \/home\/socialor\/public_html\/wp-includes\/functions.php(1343): WP->main()\
   n#17 \/home\/socialor\/public_html\/wp-blog-header.php(16): wp()\n#18 \/home\/
   socialor\/public_html\/index.php(17): require(‘\/home\/socialor\/…’)\n#19 {main}\
   n thrown”,”file”:”\/home\/socialor\/public_html\/wp-content\/plugins\/mainwp-
   child\/modules\/changes-logs\/classes\/class-changes-handle-wp-content.php”,”
   line”:128}},”additional_errors”:[]}
 * I’m using the latest version of WordPress and Php8.3.
 * MainWP Report:
 * Configuração do servidor Valor obrigatório Valor Status
 * MAINWP CHILD
   MainWP Child Versão 6.0.2 6.0.2 PassWordPressWordPress Version >
   =3.4 6.9.2 PassWordPress Memory Limit >=64M 40M WarningMultiSite Disabled =true
   true PassMétodo FileSystem = direct direct PassCONFIGURAÇÕES DO PHPPHP Version
   >=7.4 8.4.18 PassModo de segurança do PHP desativado OFFPHP Max Execution Time
   >=30 seconds 300 PassPHP Max Input Time >=30 seconds 180 PassPHP Memory Limit
   >=128M (256M+ best for big backups) 1G PassPCRE Backtracking Limit >=10000 4194304
   PassPHP Upload Max Filesize >=2M (2MB+ best for upload of big plugins) 1G PassPHP
   Post Max Size >=2M (2MB+ best for upload of big plugins) 1G PassSSL Extension
   Enabled =true true PassSSL Warnings = empty PasscURL Extension Enabled =true 
   true PasscURL Timeout >=300 seconds 60 WarningcURL Version >=7.18.1 8.14.1 PasscURL
   SSL Version >=OpenSSL/1.1.0 OpenSSL/1.1.1wPassOpenSSL Working Status Yes Yes 
   PassCONFIGURAÇÕES DO MySQLMySQL Version >=5.0 10.11.16-MariaDB-cll-lvePassINFORMAÇÕES
   DO ARQUIVO DE BACKUPZipArchive enabled in PHP =true true PassTar GZip supported
   =true true PassTar BZip2 supported =true true PassINFORMAÇÕES DO SERVIDORDiretório
   raiz do WordPress /home/socialor/public_html/Nome do Servidor social.org.brSoftware
   do Servidor LiteSpeedSistema Operacional LinuxArquitetura 64 bitIP do Servidor
   177.73.233.52Protocolo do Servidor HTTP/1.1Servidor HTTP social.org.brHTTPS Ligado–
   onConexão automática do servidor Corpo da resposta HTTP não esperado:Agente de
   usuário Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:148.0) Gecko/20100101 Firefox/
   148.0Porta do servidor 443Interface de GatewayUso de memória 14.31 MBURL Completa
   [https://social.org.br/wp-admin/plugins.php?plugin_status=all&paged=1&s](https://social.org.br/wp-admin/plugins.php?plugin_status=all&paged=1&s)
   Request Time 1773166931Aceitar Conteúdo text/html,application/xhtml+xml,application/
   xml;q=0.9,_/_;q=0.8Conteúdo Accept-Charset N/DAtualmente executando o caminho
   do roteiro /home/socialor/public_html/wp-admin/options-general.phpURL da página
   atual /wp-admin/options-general.php?page=mainwp_child_tabEndereço Remoto 201.148.188.227Servidor
   Remoto N/APorta Remota 39727INFORMAÇÕES SOBRE PHPPHP permite URL fopen LigadoPHP:
   Suporte a Exif SIM ( V8.4.)PHP: Suporte a IPTC SIMPHP: Suporte a XML SIMFunções
   Desabilitadas PHP dl, escapeshellarg, escapeshellcmd, exec, expect_popen, passthru,
   pcntl_exec, popen, posix_getpwuid, posix_kill, posix_mkfifo, posix_setegid, posix_seteuid,
   posix_setgid, posix_setpgid, posix_setsid, posix_setuid, posix_uname, proc_close,
   proc_open, shell_exec, show_source, system,Extensões PHP Carregadas Core, PDO,
   PDO_ODBC, Phar, Reflection, SPL, SimpleXML, Zend OPcache, bcmath, bz2, calendar,
   ctype, curl, date, dba, dom, enchant, exif, fileinfo, filter, ftp, gd, gettext,
   gmp, hash, iconv, imagick, imap, intl, ionCube Loader, json, ldap, libxml, litespeed,
   mbstring, mysqli, mysqlnd, odbc, openssl, pcntl, pcre, pdo_mysql, pdo_pgsql, 
   pdo_sqlite, pgsql, posix, pspell, random, readline, session, shmop, snmp, soap,
   sockets, sodium, sqlite3, standard, sysvmsg, sysvsem, sysvshm, tidy, timezonedb,
   tokenizer, xml, xmlreader, xmlwriter, xsl, zip, zlibINFORMAÇÃO DO MySQLModo do
   MySQL ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTIONCodificação
   do Cliente MySQL utf8PLUGINS do WordPressAdvanced Custom Fields 6.7.1 AtivoAkismet
   Anti-spam: Spam Protection 5.6 AtivoBlocksy Companion (Premium) 2.1.34 AtivoGetwid
   2.1.3 AtivoMainWP Child 6.0.2 AtivoPost Types Order 2.4.3 AtivoQuery Monitor 
   3.20.2 InativoUpdraftPlus – Backup/Restore 1.26.2 AtivoW3 Total Cache 2.9.2 AtivoWP
   Mail SMTP 4.7.1 AtivoYoast SEO 27.1.1 Ativo Próxima data Cronograma Gancho
 * 10 de março de 2026 15:08 Every minute action_scheduler_run_queue
   10 de março
   de 2026 15:21 [W3TC] Page Cache file GC (every 3600 seconds) w3_pgcache_cleanup10
   de março de 2026 15:40 A cada hora wp_privacy_delete_old_export_files10 de março
   de 2026 18:34 Uma vez por dia updraft_backup10 de março de 2026 18:34 Uma vez
   por dia updraft_backup_database10 de março de 2026 21:07 Duas vezes por dia updraftplus_clean_temporary_files10
   de março de 2026 22:41 Duas vezes por dia wp_update_user_counts10 de março de
   2026 22:48 Uma vez por dia fs_data_sync_blocksy-companion11 de março de 2026 
   00:10 Duas vezes por dia wp_update_plugins11 de março de 2026 00:40 Duas vezes
   por dia wp_update_themes11 de março de 2026 06:52 Uma vez por dia wpseo-reindex11
   de março de 2026 06:52 Uma vez por dia wpseo_permalink_structure_check11 de março
   de 2026 06:52 Uma vez por dia wpseo_detect_default_seo_data11 de março de 2026
   10:40 Uma vez por dia recovery_mode_clean_expired_keys11 de março de 2026 10:
   41 Uma vez por dia wp_scheduled_delete11 de março de 2026 10:41 Uma vez por dia
   delete_expired_transients11 de março de 2026 10:41 Uma vez por dia wp_scheduled_auto_draft_delete12
   de março de 2026 10:59 Duas vezes por dia wp_version_check16 de março de 2026
   10:41 Uma vez por semana wp_delete_temp_updater_backups17 de março de 2026 07:
   02 Uma vez por semana acf_update_site_health_data17 de março de 2026 10:40 Uma
   vez por semana wp_site_health_scheduled_check Tempo Erro
 *     ```wp-block-code
                                      thrown in /home/socialor/public_html/wp-content/plugins/mainwp-child/modules/changes-logs/classes/class-changes-handle-wp-content.php on line 128
                                      #8 {main}                                              
                                      #7 /home/socialor/public_html/wp-admin/revision.php(71): wp_restore_post_revision()
                                      #6 /home/socialor/public_html/wp-includes/revision.php(486): wp_update_post()
                                      #5 /home/socialor/public_html/wp-includes/post.php(5296): wp_insert_post()
                                      #4 /home/socialor/public_html/wp-includes/post.php(4901): do_action()
                                      #3 /home/socialor/public_html/wp-includes/plugin.php(522): WP_Hook->do_action()
                                      #2 /home/socialor/public_html/wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters()
                                      #1 /home/socialor/public_html/wp-includes/class-wp-hook.php(341): MainWP\Child\Changes\Changes_Handle_WP_Content::change_before_post_edit_data()
       ```
   

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

 *  Plugin Support [Bojan Katusic](https://wordpress.org/support/users/bojankatusic/)
 * (@bojankatusic)
 * [2 months, 4 weeks ago](https://wordpress.org/support/topic/in_array-argument-2-haystack-must-be-of-type-array-string-given/#post-18847186)
 * Hey [@alantygel2](https://wordpress.org/support/users/alantygel2/)
 * I was unable to reproduce this issue when saving a post on Child Sites. And we
   haven’t received other reports for this, so it appears to be an isolated issue.
 * Please open a private Help Desk ticket and we will gladly look into this: [https://mainwp.com/my-account/get-support/](https://mainwp.com/my-account/get-support/)
 *  Thread Starter [alantygel2](https://wordpress.org/support/users/alantygel2/)
 * (@alantygel2)
 * [2 months, 4 weeks ago](https://wordpress.org/support/topic/in_array-argument-2-haystack-must-be-of-type-array-string-given/#post-18847197)
 * I solved the issue.
 * The websites were I has having this issue were sites migrated from Joomla, with
   a lot of sticky posts. In order to clear these sticky posts, I just cleared the
   wp_options “sticky_posts” entry.
 * MainWP Child was expecting this to be an array, and thats why the error raised.
 * In short:
    - Disable MainWP Child
    - Set a post as sticky post
    - Unset the post as sticky
    - Activate MainWP Child
 * Then the entry will again be recovered as an array.

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

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fin_array-argument-2-haystack-must-be-of-type-array-string-given%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/mainwp-child/assets/icon-256x256.png?rev=2734948)
 * [MainWP Child - Securely Connects to the MainWP Dashboard to Manage Multiple Sites](https://wordpress.org/plugins/mainwp-child/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/mainwp-child/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/mainwp-child/)
 * [Active Topics](https://wordpress.org/support/plugin/mainwp-child/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/mainwp-child/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/mainwp-child/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [alantygel2](https://wordpress.org/support/users/alantygel2/)
 * Last activity: [2 months, 4 weeks ago](https://wordpress.org/support/topic/in_array-argument-2-haystack-must-be-of-type-array-string-given/#post-18847197)
 * Status: resolved