Tribe__Tickets_Plus__Main::retro_attendee_page_option( array $options )
Handle converting an old key to a new one, in this case ticket-attendee-page-slug -> ticket-attendee-page-id
Contents
Parameters
- $options
-
(array) (Required) List of options to save.
Return
(array) Modified list of options to save.
Source
File: src/Tribe/Main.php
public function retro_attendee_page_option( $options ) {
// Don't migrate option if old option is not set.
if ( empty( $options['ticket-attendee-info-slug'] ) ) {
return $options;
}
$slug = $options['ticket-attendee-info-slug'];
unset( $options['ticket-attendee-info-slug'] );
// ID is already set, just return $options without the slug.
if ( ! empty( $options['ticket-attendee-info-id'] ) ) {
return $options;
}
$page = get_page_by_path( $slug, OBJECT );
// Slug does not match any pages or it may have changed, just return $options without the slug.
if ( empty( $page ) ) {
return $options;
}
// Set ID to the slug page's ID and return $options without the slug.
$options['ticket-attendee-info-id'] = $page->ID;
return $options;
}
Changelog
| Version | Description |
|---|---|
| 4.10.4 | Introduced. |