/** * Assigns a specific WordPress user role based on the selected value in a WPForms multiple-choice field. * * @link https://wpforms.com/how-to-assign-user-roles-conditionally-in-wordpress/ * * @param array $user_data Array containing user registration data. * @param array $fields Array of form fields…Continue reading
function enqueue_admin_reorder_scripts() { global $pagenow; // Ensure the script is not loaded on the plugins page if ($pagenow !== ‘plugins.php’) { wp_enqueue_script(‘jquery-ui-sortable’); wp_add_inline_script(‘jquery-ui-sortable’, ‘ jQuery(document).ready(function($) { var $sortableList = $(“#the-list”); var postType = $(“body”).attr(“class”).match(/post-type-([^s]+)/)[1]; $sortableList.sortable({ update: function(event, ui) { var…Continue reading
function enqueue_admin_reorder_scripts() { global $pagenow; // Ensure the script is not loaded on the plugins page if ($pagenow !== ‘plugins.php’) { wp_enqueue_script(‘jquery-ui-sortable’); wp_add_inline_script(‘jquery-ui-sortable’, ‘ jQuery(document).ready(function($) { var $sortableList = $(“#the-list”); var postType = $(“body”).attr(“class”).match(/post-type-([^s]+)/)[1]; $sortableList.sortable({ update: function(event, ui) { var…Continue reading
function preload_first_content_image() { if (is_single()) { $post = get_post(); if ($post) { // Get post content $content = $post->post_content; // Find first image in the content preg_match_all(‘//i’, $content, $matches); if (!empty($matches[1])) { $first_image = $matches[1][0]; echo ‘‘; } } }…Continue reading
add_filter( ‘aioseo_report_summary_enable’, ‘__return_false’ );Continue reading
add_action( ‘admin_enqueue_scripts’, function () { if ( ! function_exists( ‘aioseo’ ) ) { return; } // Remove the “Select Primary Category” box from the post editor. wp_dequeue_script( ‘aioseo/js/src/vue/standalone/primary-term/main.js’ ); }, 100 ); // Prevent AIOSEO from changing the category to…Continue reading
/* * Include an invoice number into the set of Authorize.Net args. * * @link https://wpforms.com/developers/how-to-send-an-invoice-number-through-to-authorize-net-payments */ function wpf_dev_authorize_net_process_payment_single_add_invoice_to_args( $args, $process ) { // Replace 20 in $process->fields[20] to an id of your invoice field. if ( isset( $process->fields[20][ ‘value’…Continue reading