This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function kt_get_aioseo_primary_category( $post_id = 0 ) { | |
| $post_id = $post_id ? absint( $post_id ) : get_the_ID(); | |
| if ( ! $post_id ) { | |
| return false; | |
| } | |
| if ( function_exists( 'aioseo' ) ) { | |
| $aioseo = aioseo(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Temporary repair snippet for The Events Calendar Custom Tables v1. | |
| * | |
| * Use when TEC events exist as `tribe_events` posts but do not appear on the | |
| * frontend because the `wp_tec_events` / `wp_tec_occurrences` custom tables | |
| * are missing, empty, or out of sync after manual database cleanup. | |
| * | |
| * This rebuilds the TEC custom tables from existing event posts. It does not | |
| * delete event posts. Remove this snippet immediately after a successful run. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function tecdev_fallback_sync_event_custom_tables( $event_id, &$reason = '' ) { | |
| global $wpdb; | |
| $event_id = absint( $event_id ); | |
| if ( ! $event_id ) { | |
| $reason = 'Fallback: invalid event ID.'; | |
| return false; | |
| } | |
| $start_date = (string) get_post_meta( $event_id, '_EventStartDate', true ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- The Events Calendar - Custom Tables Rebuild Script | |
| -- Run this if events are not displaying on your website | |
| -- This script will rebuild the wp_tec_events and wp_tec_occurrences tables | |
| -- 1. DROP old/corrupted tables | |
| DROP TABLE IF EXISTS wp_tec_occurrences; | |
| DROP TABLE IF EXISTS wp_tec_events; | |
| -- 2. CREATE wp_tec_events table | |
| CREATE TABLE wp_tec_events ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Auto-create template override for event organizers in list view | |
| */ | |
| // Hook into init to create the template override | |
| add_action( 'init', 'create_event_organizers_template_override' ); | |
| function create_event_organizers_template_override() { | |
| // Only run once |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Auto-create template override for event tags in list view | |
| */ | |
| // Hook into init to create the template override | |
| add_action( 'init', 'create_event_tags_template_override' ); | |
| function create_event_tags_template_override() { | |
| // Only run once |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php //* Do NOT include the opening php tag | |
| add_filter( | |
| 'rest_request_after_callbacks', | |
| 'tec_tickets_maybe_hide_attendee_information_for_app', | |
| 10, | |
| 3 | |
| ); | |
| /** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function delete_all_test_ticket_orders() { | |
| if ( current_user_can('manage_options') ) { | |
| $orders = get_posts([ | |
| 'post_type' => 'tec_tc_order', | |
| 'posts_per_page' => -1, | |
| 'post_status' => 'any', | |
| ]); | |
| foreach ( $orders as $order ) { | |
| wp_delete_post( $order->ID, true ); // true = permanently delete |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * usk8-tec-cleanup.php | |
| * | |
| * Standalone cleanup script for: | |
| * A) Orphaned orders (post type: tec_tc_order) whose event (from _tec_tc_order_events_in_order) | |
| * no longer exists – along with their associated attendees (found via ticket type IDs stored in | |
| * _tec_tc_order_tickets_in_order). | |
| * B) Orphaned tickets (post type: tec_tc_ticket) whose meta key (_tec_tickets_commerce_event) | |
| * references a non‑existent event. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // force redirection on order confirmation page. | |
| add_action( 'wp', 'tec_force_redirect_after_checkout_woo', 1 ,10 ); | |
| function tec_force_redirect_after_checkout_woo(){ | |
| global $wp; | |
| $current_url = home_url(add_query_arg(array(), $wp->request)).'/'.basename($_SERVER['REQUEST_URI']); | |
| if( strpos( $current_url , 'attendee-registration/order-received/') !== false ){ | |
| $url = str_replace('attendee-registration','checkout',$current_url); | |
| wp_redirect($url); |
NewerOlder