Type: php
Temporary Code to Test WPCode
if ( current_user_can( ‘administrator’ ) ) { delete_all_posts_categories_tags_with_report(); }Continue reading
Clear Litespeed Cache
/* Plugin Name: LiteSpeed Daily Purge Description: Automatically purges LiteSpeed cache daily at 7:00 a.m. Pacific, stores purge timestamp for digest reporting. Version: 1.4 */ function run_litespeed_purge_with_digest_only() { // 🕒 Track the last time purge ran $purge_time = current_time( ‘mysql’…Continue reading
Google Tag Manager (copy)
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({‘gtm.start’: new Date().getTime(),event:’gtm.js’});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!=’dataLayer’?’&l=’+l:”;j.async=true;j.src= ‘https://www.googletagmanager.com/gtm.js?id=’+i+dl;f.parentNode.insertBefore(j,f); })(window,document,’script’,’dataLayer’,’GTM-W23H2FM’);Continue reading
made by lokalstolz
add_action(‘wp_head’, function() { echo ‘‘; }, 1);Continue reading
修改WP Memory等參數
// 設定 WordPress 記憶體限制 define(‘WP_MEMORY_LIMIT’, ‘256M’); define(‘WP_MAX_MEMORY_LIMIT’, ‘512M’); // 設定 PHP 執行層的上傳限制 @ini_set(‘upload_max_filesize’, ’64M’); @ini_set(‘post_max_size’, ’64M’); @ini_set(‘max_execution_time’, ‘300’);Continue reading
Make Avada Off-Canvas Public Post Type to Exclude from Cacheing
add_action(‘init’, function() { global $wp_post_types; if (isset($wp_post_types[‘awb_off_canvas’])) { $wp_post_types[‘awb_off_canvas’]->public = true; } }, 11);Continue reading
Disable SG Speed Optimizer File-Based Cacheing for Pages with Conditional Display Logic
add_filter( ‘sgo_bypass_query_params’, ‘add_sgo_bypass_query_params’); function add_sgo_bypass_query_params( $bypass_query_params ) { // Add custom query params, that will skip the cache. $bypass_query_params[] = ‘condis’; return $bypass_query_params; }Continue reading
allow contributors
add_filter( ‘optin_monster_api_menu_cap’, function( $cap ) { return ‘edit_posts’; } );Continue reading
allow authors
add_filter( ‘optin_monster_api_menu_cap’, function( $cap ) { return ‘publish_posts’; } );Continue reading