Automatic CSS/JavaScript Cache Busting

/** * Replace the `ver` query arg with the file’s last modified timestamp * * @param string $src URL to a file * @return string Modified URL to a file */ function filter_cache_busting_file_src( $src = ” ) { global $wp_scripts;…Continue reading

PCC Selector

// https://staging-solaiscom.temp312.kinsta.cloud/product/lcs/ include constant(‘WP_PLUGIN_DIR’) . ‘/solais-pdf/fpdm/fpdm.php’; // Start the download function product_pdf_download_file() { if (isset($_GET[‘productpdf’]) && $_GET[‘productpdf’] = ‘download’) { $post_id = get_early_postid(); $product_sheet_url = get_product_sheet_url($post_id, true); $wp_content_dir = ‘/wp-content/’; if (!empty($product_sheet_url) && stripos($product_sheet_url, $wp_content_dir) !== false) { $pdf_template =…Continue reading

Add unfiltered_html to editor role

/** * Add the unfiltered_html capability to the editor role. * Be careful which users you grant this capability to. */ add_filter( ‘map_meta_cap’, function ( $caps, $cap, $user_id ) { // Change editor with the user role you want to…Continue reading

Completely Disable Comments (copy)

add_action(‘admin_init’, function () { // Redirect any user trying to access comments page global $pagenow; if ($pagenow === ‘edit-comments.php’) { wp_safe_redirect(admin_url()); exit; } // Remove comments metabox from dashboard remove_meta_box(‘dashboard_recent_comments’, ‘dashboard’, ‘normal’); // Disable support for comments and trackbacks in…Continue reading

Gravity Forms Submit Event

/** * Send a server-side event to the FB Conversions API when a Gravity Forms form is submitted using the Conversion Pixels addon. * * @param array $entry The entry data. * @param array $form The form data. */ add_action(…Continue reading

Replace all the URLs in the Schema with the current URL

add_filter( ‘aioseo_schema_output’, ‘aioseo_schema_change_urls’ ); function aioseo_schema_change_urls( $graphs ) { if ( false === strpos( $_SERVER[‘REQUEST_URI’], ‘home-search/listing/’ ) ) { return $graphs; } $request_uri = explode( ‘?’, $_SERVER[‘REQUEST_URI’] ); $uri = trim( ( $request_uri[0] ?? ” ), ‘/’ ); $old_url =…Continue reading