Location: everywhere
Publish Future Post
// Publish Future Post / Kiri Vadivelu / 2026 function publish_future_type( $post_data ) { if ( $post_data[‘post_status’] == ‘future’ && $post_data[‘post_type’] == ‘post’ ) { $post_data[‘post_status’] = ‘publish’; } return $post_data; } add_filter(‘wp_insert_post_data’, ‘publish_future_type’); // Remove the automatic future hook…Continue reading
TEMP – Lumen font cleanup
/* * TEMP – Lumen font cleanup (admin-only, query-triggered) * ?lumen_font_cleanup=dry report only, changes nothing * ?lumen_font_cleanup=run&f=VALUE strip element-level font-family === VALUE (backs up first) * ?lumen_font_cleanup=restore put every backed-up meta value back * v2: also covers Bricks components and…Continue reading
Replace Missing Thumbnail
// Replace Missing Thumbnail / Kiri Vadivelu / 2026 function replace_missing_thumbnail( $html, $post_id, $post_thumbnail_id, $size, $attr ) { if ( empty( $html ) ) { // Replace with your site logo URL $logo_url = ‘https://example.com/path/to/logo.png’; $html = ‘‘; } return…Continue reading
test event booking system
add_action( ’em_booking_added’, ‘childlaw_test_booking_added’, 10, 1); function childlaw_test_booking_added( $booking ) { if ( ! is_object( $booking ) ) { error_log( ‘CHILDLaw: em_booking_added fired, but booking is not an object. ‘) return; } error_log( ‘BOOKING ADDED ‘) //booking id if (isset( $booking->booking_id…Continue reading
Featured Image Fallback
add_filter( ‘post_thumbnail_html’, ‘my_default_featured_image’, 10, 5 ); function my_default_featured_image( $html, $post_id, $post_thumbnail_id, $size, $attr ) { // If no HTML is generated (no featured image set) if ( empty( $html ) ) { // Replace with your actual image URL $default_image_url…Continue reading
Search Only Tag
function search_only_tag($query) { if (!is_admin() && $query->is_main_query() && $query->is_search) { $query->set(‘tag’, ‘green’); // Replace with tag name } return $query; } add_action(‘pre_get_posts’, ‘search_only_tag’);Continue reading
Search Only Category
function search_only_category($query) { if (!is_admin() && $query->is_main_query() && $query->is_search) { $query->set(‘cat’, ‘3’); // Replace with category ID(s) } return $query; } add_filter(‘pre_get_posts’, ‘search_only_category’);Continue reading
Search Only Title
add_filter( ‘post_search_columns’, function( $columns ) { return [ ‘post_title’ ]; } );Continue reading
Search Only Post
function search_only_post($query) { if (!is_admin() && $query->is_main_query() && $query->is_search) { $query->set(‘post_type’, ‘post’); } return $query; } add_filter(‘pre_get_posts’, ‘search_only_post’);Continue reading