Title: Problems with custom statuses
Last modified: March 26, 2024

---

# Problems with custom statuses

 *  [hwuser](https://wordpress.org/support/users/hwuser/)
 * (@hwuser)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/problems-with-custom-statuses/)
 * Hello, I wanted to add a custom status to event posts, and I saw this article:
   
   [https://theeventscalendar.com/knowledgebase/adding-a-custom-event-status](https://theeventscalendar.com/knowledgebase/adding-a-custom-event-status)
 *  I have put the code in my functions.php, like many other snippets, but it gives
   me this error:
 * **PHP Parse error: syntax error, unexpected ‘public’ (T_PUBLIC)**
 * Furthermore, I have seen that the article code and the video code do not match…

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

 *  Plugin Support [tristan083](https://wordpress.org/support/users/tristan083/)
 * (@tristan083)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/problems-with-custom-statuses/#post-17532898)
 * Hi [@hwuser](https://wordpress.org/support/users/hwuser/),
 * Thank you for reaching out.
 * Could you please try removing the public keyword before function so you’re left
   with the below and see if that helps?
 *     ```wp-block-code
       add_filter( 'tec_event_statuses', 'my_custom_statuses', 20, 2 );
   
       function my_custom_statuses( $statuses, $current_status ) {
               $custom_statuses = $this->custom_statuses();
   
               foreach ( $custom_statuses as $custom_status ) {
                   $statuses[] = [
                       'text'     => $custom_status[ 'name' ],
                       'id'       => $custom_status[ 'value' ],
                       'value'    => $custom_status[ 'value' ],
                       'selected' => $custom_status[ 'value' ] === $current_status ? true : false,
                   ];
               }
   
               return $statuses;
           }
   
           function custom_statuses() {
   
               $statuses = [
                   'rescheduled'     => [
                       'name'   => 'Rescheduled',
                       'value'  => 'rescheduled',
                       'schema' => 'EventRecheduled',
                   ],
                   'suspended'       => [
                       'name'   => 'Suspended',
                       'value'  => 'suspended',
                       'schema' => '',
                   ],
               ];
   
               return $statuses;
           }
       ```
   
 *  Plugin Support [Darian](https://wordpress.org/support/users/d0153/)
 * (@d0153)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/problems-with-custom-statuses/#post-17538212)
 * Hi there,
 * It seems like it has been some time since we received a response from you, therefore,
   I will consider this matter as resolved. If you require any further assistance,
   please do not hesitate to start a new thread.
 *  Thread Starter [hwuser](https://wordpress.org/support/users/hwuser/)
 * (@hwuser)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/problems-with-custom-statuses/#post-17538413)
 * Sorry, I don’t have much time to do tests.
 * I have removed the public, but now it does not recognize the $this->
 * It gives me the following error:
 * PHP Fatal error: Uncaught Error: Using $this when not in object context 
 * I think you should replicate it yourself and put the good code on the website…
   So I don’t have to do tests…
 * Thanks!!
 *  Plugin Support [Darian](https://wordpress.org/support/users/d0153/)
 * (@d0153)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/problems-with-custom-statuses/#post-17552279)
 * Hi [@hwuser](https://wordpress.org/support/users/hwuser/)
 * I appreciate you bringing this to our attention and I assure you that we will
   take the necessary steps to address this issue. I will consult with the appropriate
   team to gather more information, and once I have more information, I will keep
   you updated.
 * Thank you again for your patience and understanding.
 *  Plugin Support [Darian](https://wordpress.org/support/users/d0153/)
 * (@d0153)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/problems-with-custom-statuses/#post-17559150)
 * Hi [@hwuser](https://wordpress.org/support/users/hwuser/)
 * Thanks for patiently waiting. Please try to remove the `$this` to resolve the
   issue.
 * From `$custom_statuses = $this->custom_statuses();`
 * to
 * `$custom_statuses = custom_statuses();`
 * Let me know how it goes.
 *  Plugin Support [Darian](https://wordpress.org/support/users/d0153/)
 * (@d0153)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/problems-with-custom-statuses/#post-17679382)
 * Hi there,
 * It seems like this thread has been quiet for a bit, so we’ll go ahead and mark
   it as **resolved**. However, if any further questions or concerns come up, please
   don’t hesitate to start a new thread.
 *  Thread Starter [hwuser](https://wordpress.org/support/users/hwuser/)
 * (@hwuser)
 * [2 years ago](https://wordpress.org/support/topic/problems-with-custom-statuses/#post-17747765)
 * Hello, I already told you that I haven’t been able to try it because I don’t 
   have time to do what you tell me. I understand that you who are the authors of
   the plugin will have to test this.

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

The topic ‘Problems with custom statuses’ is closed to new replies.

 * ![](https://ps.w.org/the-events-calendar/assets/icon-256x256.gif?rev=2516440)
 * [The Events Calendar](https://wordpress.org/plugins/the-events-calendar/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/the-events-calendar/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/the-events-calendar/)
 * [Active Topics](https://wordpress.org/support/plugin/the-events-calendar/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/the-events-calendar/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/the-events-calendar/reviews/)

 * 7 replies
 * 3 participants
 * Last reply from: [hwuser](https://wordpress.org/support/users/hwuser/)
 * Last activity: [2 years ago](https://wordpress.org/support/topic/problems-with-custom-statuses/#post-17747765)
 * Status: not a support question