Posts

Disable WordPress dashboard for all but administrators.

function disable_dashboard() { if (!is_user_logged_in()) { return null; } if ( is_admin() && !defined('DOING_AJAX') && current_user_can('subscriber')) { wp_redirect(home_url()); exit; } } add_action('admin_init', 'disable_dashboard');

Disable WYSIWYG

add_action('init', 'init_remove_support',100); function init_remove_support(){ remove_post_type_support( 'post', 'editor'); }

How to Find SESSDATA Cookie in Google Chrome

Follow these steps to locate your SESSDATA cookie in Google Chrome: Open Google Chrome and ensure you're logged in to your Bilibili account. Right-click anywhere on the page and select "Inspect" or press Ctrl + Shift + I (or Cmd + Option + I on Mac) to open the Developer Tools panel. In the Developer Tools panel, go to the "Application" tab. In the left sidebar, expand the "Cookies" section, and then click on "https://www.example.com." You should see a list of cookies associated with the Bilibili website. Look for the SESSDATA cookie. The value next to it is your SESSDATA session data. Now you have successfully found your SESSDATA cookie in Google Chrome.

OPcache

opcache.consistency_checks: Enables or disables consistency checks for cached files. opcache.dups_fix: Fixes opcode duplication in a specific scenario. opcache.enable: Enables or disables the OPcache extension. opcache.enable_cli: Enables or disables OPcache when running PHP from the command line (CLI). opcache.enable_file_override: Enables or disables overriding files from the cache. opcache.error_log: Specifies the file path for OPcache error logs. opcache.file_cache: Enables file-level caching. opcache.file_cache_consistency_checks: Enables or disables consistency checks for the file cache. opcache.file_cache_only: Enables file cache mode, disabling opcode cache. opcache.file_update_protection: Prevents cache updates if files are changed too frequently. opcache.force_restart_timeout: Maximum time, in seconds, to wait for restarts in case of errors. opcache.huge_code_pages: Enables or disables using huge pages for code memory. opcache.interned_s

How to Disable Redis Object Cache HTML comments in WordPress

 <!-- Performance optimized by Redis Object Cache. Learn more: https://wprediscache.com Retrieved 4409 objects (535 KB) from Redis using PhpRedis (v5.3.7). --> Open the wp-config.php, add the following line of code to the section where other constants are defined:  define('WP_REDIS_DISABLE_COMMENT', true);

meta query

https://developer.wordpress.org/reference/classes/wp_meta_query/ $pattern = ""; 'meta_query' => array(     array(         'key'      => 'birthday',         'value'    => $pattern,         'compare' => 'REGEXP'     ), 'popularity_clause' => array(         'key' => 'subscription_count',         'compare' => 'EXISTS', 'type' => 'NUMERIC'      )    ),   'orderby' => array(      'popularity_clause' => 'DESC',     'title'      => 'ASC'     ) 'meta_query' => array(     array(         'key'      => 'key-1',         'value'    => $value,         'compare' => '='     ), 'x_clause' => array(         'key' => 'key-2',         'compare' => 'EXISTS'     )       ),   'meta_ty