// Ask the chatbot from your own code (same rules as the widget: sources, refusal, caps)
$r = TQCB_Chat::ask( 'How long does delivery take?' );
// $r['type'] is answer, refusal, handover or unavailable; $r['text'], $r['sources'] (title, url)
// Keep some items out of the index (drafts, private items and passwords are always out)
add_filter( 'tqcb_indexable', function ( $ok, $post ) {
return $ok && ! has_category( 'internal', $post );
}, 10, 2 );
// Add a custom field to the text that is read
add_filter( 'tqcb_item_text', function ( $text, $post ) {
return $text . "\n\nOpening hours: " . get_post_meta( $post->ID, 'hours', true );
}, 10, 2 );
// Your brand voice (keep the rules of the prompt)
add_filter( 'tqcb_system_prompt', function ( $prompt ) {
return $prompt . "\nUse a warm, short style.";
} );
// Hide the widget on some pages
add_filter( 'tqcb_show_widget', function ( $show ) {
return $show && ! is_page( 'landing' );
} );
// The key can live in wp-config.php
define( 'TQCB_AI_KEY', 'sk-...' );