Skip to content

Instantly share code, notes, and snippets.

View chikaibeneme's full-sized avatar
:atom:
Focusing

Chika Ibeneme chikaibeneme

:atom:
Focusing
  • iKaDigital
  • Jamaica
View GitHub Profile
@chikaibeneme
chikaibeneme / AIOSEO.php
Created May 6, 2026 06:25
script for kadence
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();
@chikaibeneme
chikaibeneme / tec-custom-tables-v1-repair-functions-snippet.php
Last active May 5, 2026 04:45
Temporary WordPress admin-only functions.php snippet to rebuild The Events Calendar Custom Tables v1 data after missing wp_tec_events / wp_tec_occurrences tables or stale migration state.
/**
* 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.
@chikaibeneme
chikaibeneme / resync events.php
Last active February 27, 2026 07:31
resync events.php
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 );
@chikaibeneme
chikaibeneme / post migration rebuild.sql
Created February 10, 2026 09:03
Manually Rebuilding Custom Tables after Migration
-- 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 (
@chikaibeneme
chikaibeneme / display organizers in list view.php
Created August 22, 2025 04:28
display organizers in list view for TEC
/**
* 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
@chikaibeneme
chikaibeneme / event-list-tag.php
Last active August 20, 2025 04:45
This snippet adds event tags to the list view
/**
* 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
@chikaibeneme
chikaibeneme / tec-tickets-hide-attendee-information-for-app.php
Last active August 16, 2025 06:23
Hide attendee information for the Event Tickets Plus APP.
<?php //* Do NOT include the opening php tag
add_filter(
'rest_request_after_callbacks',
'tec_tickets_maybe_hide_attendee_information_for_app',
10,
3
);
/**
@chikaibeneme
chikaibeneme / delete_all_test_ticket_orders.php
Last active May 1, 2025 05:05
delete_all_test_ticket_orders
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
@chikaibeneme
chikaibeneme / orphaned post cleanup.php
Created April 18, 2025 07:35
orphaned post cleanup.php
<?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.
@chikaibeneme
chikaibeneme / force redirection on order confirmation page.php
Created April 11, 2025 21:52
force redirection on order confirmation page
// 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);