Remove file version strings from CSS and JS links
By default .css and .js files used in WordPress themes and plugins will add a version number using ?ver= To disable this add the following inside your theme functions.php file or as a new plugin:
By default .css and .js files used in WordPress themes and plugins will add a version number using ?ver= To disable this add the following inside your theme functions.php file or as a new plugin:
Add the following to your theme functions.php file: Source: WordPress搜索功能结果只有一个时直接跳转到结果文章页面
This small script uses a for loop to delete one post ID at a time, it will go through the database and list all media files uploaded in the provided data range that are not used inside posts. Change the date range according to your needs.
One of the biggest disadvantages of the Gutenberg editor is that the width of the editor is not as full-width as the classic editor. In many themes, the background editing interface is very narrow compared to the actual article page, resulting in different front and back layouts, which affects the article. In this article, We’ll … Read full article →
WordPress hooks are a powerful feature that allows you to customize and extend the functionality of your WordPress website without modifying the core code. They are essentialy points in the WordPress code where you can add your own custom code or functions. There are two types of hooks in WordPress: actions and filters. Action hooks … Read full article →
60 seconds or less, that’s all that takes to create a WordPress child theme and I highly recommend that you do it before even thinking about making any code or style modifications to your active theme. There are two files that you can use inside a child theme to overwrite parent theme’s functionality or style: … Read full article →
There are a few different ways that you can block access to your WordPress website if a user is coming from a specific website: Blocking access using a plugin There are several WordPress plugins that allow you to block access to your website based on the referral URL. These plugins typically allow you to specify … Read full article →
In this example, we’ll use the is_user_logged_in() to display a different theme on our website for visitors: if(is_user_logged_in()) { function wpxss_set_my_custom_theme() { //replace your theme name here return ‘your-theme-name’; } add_filter( ‘template’, ‘wpxss_set_my_custom_theme’ ); add_filter( ‘stylesheet’, ‘wpxss_set_my_custom_theme’ ); } else { // leave the default theme active for visitors } The template and stylesheet filters are responsible to select the activated … Read full article →
Preventing the site from being indexed by search engines is a feature that is often used when building a site for a client because we don’t want Google to index it until it is ready. Preventing indexing in this case is necessary because the site is in the development phase and the links of the … Read full article →
Here are some useful commands to clear cache from the terminal with wpcli: cdn_purge purge URLs from CDN and Varnish flush all flushes all cache related to W3TC (Page Cache, OC, DB Cache, Minify, etc.) flush page flushes pages cache only flush posts flushes both pages & posts cache flush database flushes DB cache flush … Read full article →