Title: Errors when I add a post
Last modified: March 16, 2024

---

# Errors when I add a post

 *  Resolved [Hellston Linhares](https://wordpress.org/support/users/hellstoncrusher/)
 * (@hellstoncrusher)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/errors-when-i-add-a-post/)
 * When I add a post, this series of errors appears on the page, and then the post
   editor loads normally…
 * **Warning**: Undefined array key 3 in **/home/wwfd/forquilhadespachante.com.br/
   wp-content/plugins/s2member/src/includes/classes/security-rest.inc.php** on line**
   46**
 * **Warning**: Undefined array key 3 in **/home/wwfd/forquilhadespachante.com.br/
   wp-content/plugins/s2member/src/includes/classes/security-rest.inc.php** on line**
   46**
 * **Warning**: Undefined array key 3 in **/home/wwfd/forquilhadespachante.com.br/
   wp-content/plugins/s2member/src/includes/classes/security-rest.inc.php** on line**
   46**
 * **Warning**: Undefined array key 3 in **/home/wwfd/forquilhadespachante.com.br/
   wp-content/plugins/s2member/src/includes/classes/security-rest.inc.php** on line**
   46**
 * **Warning**: Undefined array key 3 in **/home/wwfd/forquilhadespachante.com.br/
   wp-content/plugins/s2member/src/includes/classes/security-rest.inc.php** on line**
   46**
 * **Warning**: Undefined array key 3 in **/home/wwfd/forquilhadespachante.com.br/
   wp-content/plugins/s2member/src/includes/classes/security-rest.inc.php** on line**
   46**
 * **Warning**: Undefined array key 3 in **/home/wwfd/forquilhadespachante.com.br/
   wp-content/plugins/s2member/src/includes/classes/security-rest.inc.php** on line**
   46**
 * **Warning**: Undefined array key 3 in **/home/wwfd/forquilhadespachante.com.br/
   wp-content/plugins/s2member/src/includes/classes/security-rest.inc.php** on line**
   46**
 * **Warning**: Undefined array key 3 in **/home/wwfd/forquilhadespachante.com.br/
   wp-content/plugins/s2member/src/includes/classes/security-rest.inc.php** on line**
   46**

Viewing 1 replies (of 1 total)

 *  Plugin Author [Cristián Lávaque](https://wordpress.org/support/users/clavaque/)
 * (@clavaque)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/errors-when-i-add-a-post/#post-17516100)
 * Thanks for reporting that!
 * I will include this in the next release, but you can try it now if you want…
 * In the file mentioned in the warning: /wp-content/plugins/s2member/src/includes/
   classes/security-rest.inc.php
 * The lines mentioned, 45 and 46, are these:
 *     ```wp-block-code
         $type  = sanitize_key($route[2]); // e.g. pages
         $id    = (int)$route[3];
       ```
   
 * You can add these right before/above:
 *     ```wp-block-code
         if (empty($route[2]) || empty($route[3]))
           return $response;
       ```
   
 * So you’ll have this:
 *     ```wp-block-code
         $route = $request->get_route(); // e.g. /wp/v2/pages
         $route = explode('/', trim($route, '/'));
   
         if (empty($route[2]) || empty($route[3]))
           return $response;
   
         $type  = sanitize_key($route[2]); // e.g. pages
         $id    = (int)$route[3];
       ```
   
 * Let me know if you try it and if it helps you!
 * Warnings are not serious, errors would stop the script from going on. But you
   may want to hide warnings and errors. If not disable them, at least not display
   them on the site, instead log them into a file. [https://wordpress.org/documentation/article/debugging-in-wordpress/#wp_debug_log](https://wordpress.org/documentation/article/debugging-in-wordpress/#wp_debug_log)
 * 🙂

Viewing 1 replies (of 1 total)

The topic ‘Errors when I add a post’ is closed to new replies.

 * ![](https://ps.w.org/s2member/assets/icon-256x256.png?rev=980067)
 * [s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions](https://wordpress.org/plugins/s2member/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/s2member/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/s2member/)
 * [Active Topics](https://wordpress.org/support/plugin/s2member/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/s2member/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/s2member/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Cristián Lávaque](https://wordpress.org/support/users/clavaque/)
 * Last activity: [2 years, 2 months ago](https://wordpress.org/support/topic/errors-when-i-add-a-post/#post-17516100)
 * Status: resolved