Skip to content

Instantly share code, notes, and snippets.

<?php
//send and display response data from an api or webhook
add_action('wpcf7_before_send_mail', 'send_to_api_webhook', 10, 3);
function send_to_api_webhook($contact_form, &$abort, $submission)
{
// replace your-subject with your form field
$get_input_user = $submission->get_posted_data('your-subject');
<?php
function wpcb_should_override_backorder( $product ) {
//Set the product categories in the array
$categories = array('cat-a', 'cat-b');
return has_term( $categories, 'product_cat' ) && $product->get_attribute('pa_attr-a');
}
<?php
add_action('wp', function () {
if (is_singular('page')) {
add_action('wp_head', function () {
$JS = <<<EOD
<script>
alert('test');
</script>
EOD;
@ovidiumght
ovidiumght / tz_to_utc_when_scheduling_posts.js
Last active May 28, 2021 18:46
Convert the time to UTC from the selected timezone when scheduling posts.
jQuery(document).ready(function () {
var tzs = [
'Europe/Andorra',
'Asia/Dubai',
'Asia/Kabul',
'Europe/Tirane',
'Asia/Yerevan',
'Antarctica/Casey',
'Antarctica/Davis',