Title: Custom Fields Error
Last modified: March 24, 2017

---

# Custom Fields Error

 *  Resolved [Brandon Moser](https://wordpress.org/support/users/brandonmoser/)
 * (@brandonmoser)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/custom-fields-error-4/)
 * Greetings,
 * I’m encountering the following error after having adding a few custom fields.
   The error occurs after a completed reservation.
 * **Warning:** Illegal string offset ‘event_id’ in /home/ama/public_html/wp-content/
   plugins/my-tickets/mt-notifications.php on line 323
 * **Warning:** Illegal string offset ‘traditional_chicken_piccata’ in /home/ama/
   public_html/wp-content/plugins/my-tickets/mt-notifications.php on line 324
 * The error repeats itself for each of the custom fields I’ve created, which is
   currently only 2. The errors are only occurring on events that **do not** have
   the custom fields assigned to them. The event that does have the fields assigned
   to it is working as intended (ID 310).
 * Here is the code I’m using to add the custom fields:
 *     ```
       function create_custom_fields( $meals ) {
       	// Other fields: sanitize callback; input type; input values; display_callback
       	$meals = array(
       		'traditional_chicken_piccata' => array( 
       			'title'=>"Traditional Chicken Piccata:", 
       			'sanitize_callback'=>'sanitize_callback', 
       			'display_callback'=>'display_callback',
       			'input_type'=>'number',
       			'context'=> '310'
       		),
       		'flank_steak_roulade' => array( 
       			'title'=>"Flank Steak Roulade:", 
       			'sanitize_callback'=>'sanitize_callback', 
       			'display_callback'=>'display_callback',
       			'input_type'=>'number',
       			'context'=> '310'
       		)
       	);
       	return $meals;
       }
   
       /* Display callback formats the saved data. $context is 'payment' or 'cart', depending on whether it appears in an admin payment or the user's shopping cart. */
       function display_callback( $data, $context='payment' ) {
       	return urldecode( $data );
       }
   
       /* Sanitize callback cleans the data before saving to the DB */
       function sanitize_callback( $data ) {
       	return esc_sql( $data );
       }
   
       ?>
       ```
   
 * Any assistance you can provided would be greatly appreciated. Thanks.

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

 *  Plugin Author [Joe Dolson](https://wordpress.org/support/users/joedolson/)
 * (@joedolson)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/custom-fields-error-4/#post-8956495)
 * Thanks for reporting that; I’ll get it taken care of in the next release.
 *  Thread Starter [Brandon Moser](https://wordpress.org/support/users/brandonmoser/)
 * (@brandonmoser)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/custom-fields-error-4/#post-9020712)
 * Thanks, I appreciate it. Great plugin BTW 🙂

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

The topic ‘Custom Fields Error’ is closed to new replies.

 * ![](https://ps.w.org/my-tickets/assets/icon-256x256.png?rev=1097581)
 * [My Tickets - Accessible Event Ticketing](https://wordpress.org/plugins/my-tickets/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/my-tickets/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/my-tickets/)
 * [Active Topics](https://wordpress.org/support/plugin/my-tickets/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/my-tickets/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/my-tickets/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Brandon Moser](https://wordpress.org/support/users/brandonmoser/)
 * Last activity: [9 years, 1 month ago](https://wordpress.org/support/topic/custom-fields-error-4/#post-9020712)
 * Status: resolved