Difference between revisions of "WordPress"

From Indie IT Wiki
 
(121 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
== Installation ==
 +
 +
to be done
 +
 +
[https://www.localwp.com/ Local WP]
 +
 +
[https://cdn.localwp.com/stable/latest/deb Local WP - Latest Ubuntu DEB]
 +
 +
=== Time Limited Test Instant WordPress Sites ==
 +
 +
[https://tastewp.com TasteWP]
 +
 +
[https://instawp.com InstaWP]
 +
 +
== Allow WebP Images ==
 +
 +
Plugins > WPCode Lite > Snippets > Add New > Add Your Custom Code (New Snippet) > PHP Snippet > "Allow WebP Image Files" >
 +
 +
function cc_mime_types($mimes) {
 +
    $mimes['webp'] = 'image/webp';
 +
    return $mimes;
 +
}
 +
add_filter('upload_mimes', 'cc_mime_types');
 +
 
== SSL When Using A Reverse Proxy ==
 
== SSL When Using A Reverse Proxy ==
  
Line 11: Line 35:
  
 
https://wordpress.org/support/article/administration-over-ssl/#using-a-reverse-proxy
 
https://wordpress.org/support/article/administration-over-ssl/#using-a-reverse-proxy
 +
 +
== Enable Theme Editor ==
 +
 +
define( 'DISALLOW_FILE_EDIT', false );
  
 
== Create Blank Page Templates ==
 
== Create Blank Page Templates ==
Line 160: Line 188:
  
 
[https://managewp.com/blog/google-analytics Google Analytics SEO Tips]
 
[https://managewp.com/blog/google-analytics Google Analytics SEO Tips]
 +
 +
[https://seosly.com/google-analytics-4-basic-seo-guide/ Google Analytics 4 Basic (SEO) Guide]
  
 
== Email ==
 
== Email ==
 +
 +
=== SMTP ===
  
 
[https://wordpress.org/plugins/fluent-smtp/ Fluent SMTP]
 
[https://wordpress.org/plugins/fluent-smtp/ Fluent SMTP]
 +
 +
=== Forms ===
 +
 +
[https://wordpress.org/plugins/fluentform/ Fluent Forms]
 +
 +
==== Fluent Forms Notification Email From Dropdown Address ====
 +
 +
The '''.value''' at the end of a field name is the key, otherwise you would get the Label.
 +
 +
{inputs.dropdown-name-attribute.value}
 +
 +
https://twitter.com/Fluent_Forms/status/1553958492813533184
  
 
== Royalty Free Images ==
 
== Royalty Free Images ==
Line 208: Line 252:
  
 
== Performance Tweaks ==
 
== Performance Tweaks ==
 +
 +
Why Is WordPress Slow?
 +
 +
However, many factors can affect your WordPress site’s performance. Some of the most common ones include:
 +
 +
* Your site’s web hosting provider
 +
* Server-side optimizations (PHP version, caching, compression, etc.)
 +
* Sluggish WordPress themes
 +
* Slow WordPress plugins
 +
* Unoptimized content (mainly images)
 +
* Too many external HTTP requests
 +
* Not using a dedicated resource to serve content (CDN, video hosting, etc.)
 +
 +
[https://perfmatters.io/wordpress-performance-checklist/ Performance Checklist]
  
 
=== Hidden Options ===
 
=== Hidden Options ===
Line 281: Line 339:
 
=== Caching ===
 
=== Caching ===
  
Here is a quick list of the different types of caching we can identify:
+
WordPress 6.1 and later now includes checks for '''Page Cache and Object Cache''' in the Site Health tool.
 +
 
 +
''How do I disable the cache checks?''  Add these code snippets:-
  
* '''Page''' cache: it happens on the server and stores the entire HTML of a page (as WP Rocket does);
+
function disable_full_page_cache_check( $tests ) {
* '''Browser''' cache: it keeps storing the HTML but occurs on the browser;
+
    unset( $tests['async']['page_cache'] );
 +
    return $tests;
 +
}
 +
add_filter( 'site_status_tests', 'disable_full_page_cache_check' );
 +
 
 +
function disable_object_cache_check( $tests ) {
 +
    unset( $tests['direct']['persistent_object_cache'] );
 +
    return $tests;
 +
}
 +
add_filter( 'site_status_tests', 'disable_object_cache_check' );
 +
 
 +
WordPress Caching
 +
 
 +
Caching strategy is a key decision for any WordPress site for speed and performance. There are typically 4 levels of caching recommended for WordPress. Here is a description of how we will set up caching for WordPress with Docker:
 +
 
 +
'''Browser Caching:''' This is what tells the visitors browser to cache the files locally to speed up future site/page visits. We will set this up using Nginx. On Apache, this is accomplished using .htaccess files.
 +
 
 +
'''Server Caching:''' This caches static versions of pages (Page cache). We are going to accomplish this using Nginx FastCGI cache.
 +
 
 +
'''Frontend Caching:''' This means caching WordPress PHP files so they don't have to be re-compiled for every visit. We are going to set this up using PHP OpCache.
 +
 
 +
'''Database Caching:''' This optimizes database queries by storing them in the RAM for faster delivery. We are going to use Redis for this.
 +
 
 +
As mentioned before, I have Cloudflare and Ezoic Site Speed+ that serve cached and optimized content to visitors. But even without those, the above caching strategy should deliver excellent speeds.
 +
 
 +
https://www.smarthomebeginner.com/wordpress-on-docker-traefik/
 +
 
 +
 
 +
Here is a quick list of the different types of caching we can identify:
 +
 
 +
* '''Page''' cache: it happens on the server and stores the entire HTML of a page (as WP Rocket does);
 +
* '''Browser''' cache: it keeps storing the HTML but occurs on the browser;
 
* '''Object''' cache: it stores database queries;
 
* '''Object''' cache: it stores database queries;
 
* '''Bytecode''' cache: it's a PHP extension and stores precompiled script bytecode in the memory;
 
* '''Bytecode''' cache: it's a PHP extension and stores precompiled script bytecode in the memory;
Line 291: Line 382:
  
 
==== Browser Caching ====
 
==== Browser Caching ====
 +
 +
For Apache .htaccess ...
 +
 +
<IfModule mod_expires.c>
 +
  ExpiresActive on
 +
 
 +
  # whitelist expires rules
 +
  ExpiresDefault "access 1 month"
 +
 
 +
  # Favicon (cannot be renamed)
 +
  ExpiresByType image/x-icon "access plus 1 week"
 +
 
 +
  # Media: images, video, audio
 +
  ExpiresByType image/gif "access plus 1 month"
 +
  ExpiresByType image/png "access plus 1 month"
 +
  ExpiresByType image/jpg "access plus 1 month"
 +
  ExpiresByType image/jpeg "access plus 1 month"
 +
  ExpiresByType video/ogg "access plus 1 month"
 +
  ExpiresByType audio/ogg "access plus 1 month"
 +
  ExpiresByType video/mp4 "access plus 1 month"
 +
  ExpiresByType video/webm "access plus 1 month"
 +
 
 +
  # Webfonts
 +
  ExpiresByType application/x-font-ttf "access plus 1 month"
 +
  ExpiresByType font/opentype "access plus 1 month"
 +
  ExpiresByType application/x-font-woff "access plus 1 month"
 +
  ExpiresByType image/svg+xml "access plus 1 month"
 +
 
 +
  # CSS and JavaScript
 +
  ExpiresByType text/css "access plus 1 month"
 +
  ExpiresByType text/javascript "access plus 1 month"
 +
  ExpiresByType application/javascript "access plus 1 month"
 +
 
 +
  <IfModule mod_headers.c>
 +
    Header append Cache-Control "public"
 +
  </IfModule>
 +
</IfModule>
  
 
https://www.tweaked.io/guide/lighttpd/
 
https://www.tweaked.io/guide/lighttpd/
Line 323: Line 451:
  
 
You can open the source code of a page (Google Chrome) View > Developer > View Source and scroll to the bottom. You should see an HTML-comment that states the site was cached by W3 Total Cache.
 
You can open the source code of a page (Google Chrome) View > Developer > View Source and scroll to the bottom. You should see an HTML-comment that states the site was cached by W3 Total Cache.
 +
 +
==== Perf Matters ====
 +
 +
This is a paid-for plugin that does an amazing selection of optimisation for WordPress.  Seriously, everything.
 +
 +
https://perfmatters.io/features/
  
 
==== WP Rocket ====
 
==== WP Rocket ====
Line 339: Line 473:
  
 
=== Links ===
 
=== Links ===
 +
 +
'''[https://perfmatters.io/features/ Perf Matters]'''
 +
 +
[https://wordpress.org/plugins/performance-lab/ Performance Lab (WebP and Cache) Plugin]
 +
 +
[https://www.freecodecamp.org/news/wordpress-plugins-to-improve-your-website-performance/ Improve WordPress Web Site Performance]
  
 
[https://www.uptrends.com/tools/website-speed-test UpTrends Web Site Speed Test]
 
[https://www.uptrends.com/tools/website-speed-test UpTrends Web Site Speed Test]
Line 399: Line 539:
 
  Dashboard > WP Rocket > Clear Cache
 
  Dashboard > WP Rocket > Clear Cache
  
== Divi ==
+
=== Change Default Font ===
  
=== Updates ===
+
[https://themewaves.com/how-to-change-the-default-font-in-elementor-step-by-step/ How To Change The Default Font In Elementor (Step By Step) – ThemeWaves]
  
[https://www.elegantthemes.com/api/changelog/divi.txt Changelog]
+
=== Fix Update Database Error ===
  
=== Customise For Mobile View ===
+
This command will update the database, if an update is needed...
  
Divi > Theme Customizer link within your WordPress Dashboard. Next look for the Mobile Styles panel and open it to reveal the mobile styling options. You will notice 3 sections within the Mobile Styles panel: Tablet, Phone and Mobile Menu.
+
wp elementor update db
 +
 
 +
This command will update the Elementor Pro database, if an update is needed...
 +
 
 +
wp elementor-pro update db
 +
 
 +
This command will update the database even if another process is running...
 +
 
 +
wp elementor update db --force
 +
 
 +
This command will update the database for each site in the network...
 +
 
 +
wp elementor update db --network
 +
 
 +
https://developers.elementor.com/docs/cli/update-db/
 +
 
 +
== Divi ==
 +
 
 +
=== Updates ===
 +
 
 +
[https://www.elegantthemes.com/api/changelog/divi.txt Changelog]
 +
 
 +
=== Customise For Mobile View ===
 +
 
 +
Divi > Theme Customizer link within your WordPress Dashboard. Next look for the Mobile Styles panel and open it to reveal the mobile styling options. You will notice 3 sections within the Mobile Styles panel: Tablet, Phone and Mobile Menu.
  
 
=== Remove Divi Menu Drop Shadow ===
 
=== Remove Divi Menu Drop Shadow ===
Line 421: Line 585:
 
https://www.elegantthemes.com/blog/resources/elegant-icon-font
 
https://www.elegantthemes.com/blog/resources/elegant-icon-font
  
== WP Page Builder ==
+
== Breakdance ==
  
WP Page Builder is a drag and drop WordPress plugin to create websites on the fly. Whether you need to build web pages from scratch or edit them thoroughly, WP Page Builder brings all essential site-building elements to a single place for you.
+
Breakdance is an easy-to-use visual site builder for WordPress. It allows you to build websites from start to finish - including custom headers, footers, blog templates and dynamic page layouts - all without touching a line of code.
  
It is a completely front-end based tool with plenty of design options and tons of design elements. WP Page Builder is so lightweight, as a result, it takes remarkably less time than all other similar tools to create websites on WordPress. It gives the complete control over your website's design, so you can shape it the way you want. The plugin offers 30+ functional addons to bring any design you want for your site.
+
Breakdance is a new WordPress page builder focused on both power and speed. The builder was recently released in September 2022 and features over 120 block elements usable through a drag & drop UI.
  
https://wordpress.org/plugins/wp-pagebuilder/
+
It has been created by the makers of Oxygen and combines the best parts of Oxygen withe best parts of Bricks and Elementor.
  
https://docs.themeum.com/wp-pagebuilder/
+
'''[https://fellowshipstudios.com/breakdance-builder-review/ Review with List of Features]'''
  
https://www.youtube.com/watch?v=Crqpz6iTWH4
+
[https://breakdance.com/why/comparison/ Why Breakdance?]
  
https://www.youtube.com/watch?v=EKDZ7pvNSLs
+
[https://breakdance.com/ Official Web Site]
  
== Oxygen Builder ==
+
[https://breakdance.com/documentation/ Documentation]
  
=== Introduction ===
+
[https://breakdance.canny.io/ Roadmap]
  
Oxygen is a plugin that replaces the Theme system in WordPress. It allows you to build your own Templates for use in any page. It produces the most efficient code and the fastest loading web sites.
+
[https://www.youtube.com/@OfficialBreakdance YouTube Channel]
  
=== Features ===
+
[https://breakdance.canny.io/features Feature Requests]
  
https://wparena.com/oxygen-review/
+
[https://breakdance.com/feed/ RSS News Feed]
  
=== Purchase ===
+
=== Global Settings ===
  
https://oxygenbuilder.com/pricing
+
==== Typography ====
  
=== Installation ===
+
Heading Font [https://rosua.org/ Yabe Webfont]
 +
Body Font [https://rosua.org/ Yabe Webfont]
  
Plugins > Add New > Upload Plugin > Browse > Install Now
+
Advanced > Headings
  
=== Documentation ===
+
H1 = clamp(2.4rem, calc(2.4rem + ((1vw - 0.32rem) * 0.8333)), 3.2rem)
 +
H2 = clamp(2.0rem, calc(2.0rem + ((1vw - 0.32rem) * 0.625)), 2.8rem)
 +
H3 = clamp(1.8rem, calc(1.8rem + ((1vw - 0.32rem) * 0.2083)), 2.2rem)
 +
H4 = clamp(1.3rem, calc(1.3rem + ((1vw - 0.32rem) * 0.4167)), 1.8rem)
 +
H5 = clamp(1.1rem, calc(1.1rem + ((1vw - 0.32rem) * 0.4167)), 1.4rem)
 +
H6 = clamp(1.0rem, calc(1.0rem + ((1vw - 0.32rem) * 0.4167)), 1.2rem)
  
https://oxygenbuilder.com/documentation/
+
This, just doesn't seem to work (hopefully AutomaticCSS will come to the rescue soon!) so I have put some fixed viewport settings here for now:-
  
=== Support ===
+
Desktop = 3.0rem
 +
Tablet Landscape = 2.7rem
 +
Tablet Portrait = 2.0rem
 +
Phone Landscape = 1.8rem
 +
Phone Portrait = 1.6rem
  
[https://app.slack.com/client/TAJ828N82/CAJ5461DH Slack - Oxygen Builder General Support]
+
==== Containers ====
  
[https://oxygenbuilder.com/support Oxygen - Official Support]
+
{| class="wikitable"
 
+
|+ Sections
[https://github.com/soflyy/oxygen-bugs-and-features/issues Github - Oxygen Bugs and Features]
+
|-
 +
! Responsive Size !! Vertical Padding !! Horizontal Padding
 +
|-
 +
| Desktop || 80 px || 32 px
 +
|-
 +
| Tablet Landscape || 70 px || 28 px
 +
|-
 +
| Tablet Portrait || 55 px || 22 px
 +
|-
 +
| Phone Landscape || 45 px || 18 px
 +
|-
 +
| Phone Portrait || 30 px || 12 px
 +
|}
  
 
=== Tips ===
 
=== Tips ===
  
==== Responsive ====
+
'''Fix Gutenberg'''
  
[https://websemantics.uk/tools/responsive-font-calculator/ Fluid Resposive Font Size Calculator]
+
'''Breakdance > Settings > Performance''' > untick 'Remove Gutenberg Blocks CSS', then add the following code to CSS which fixes flex rows ...
  
===== Fonts =====
+
.breakdance figure {
 +
  width: unset;
 +
}
  
'''CSS clamp()'''
+
'''Globally Change Colour Of Icon On Menu Builder Dropdown'''
  
CSS clamp is a function that sets responsive unit sizes without any media queries. The function takes 3 parameters in this order:
+
Menu Builder / Desktop Menu / Dropdowns / Links / Graphic / Icon
  
# min - where to start scaling from.
+
'''Reduce Height Of Sticky Header On Scroll'''
# viewport width - the range determines how fast the min scales to the max based on the screen getting larger.
 
# max - when to stop scaling.
 
  
'''Add CSS'''
+
Size on desktop 100px
 +
Spacing / Padding 0
 +
Sticky / Style / Minimum height 60px
  
Oxygen > Templates > Edit Template > Manage > Stylesheets > Add Stylesheet > Clamp
+
=== Templates ===
  
/* Base */
+
https://bdlibraryawesome.com/
 
html {
 
  font-size: 62.5%;
 
}
 
  
'''Add Clamp'''
+
== Oxygen Builder ==
  
Oxygen > Templates > Edit Template > Manage > Settings > Global Styles > Headings
+
=== Introduction ===
  
H1 = clamp(3.2rem, calc(3.2rem + ((1vw - 0.32rem) * 1.6667)), 4.8rem)
+
Oxygen is a plugin that replaces the Theme system in WordPress. It allows you to build your own Templates for use in any page. It produces the most efficient code and the fastest loading web sites.
H2 = clamp(2.8rem, calc(2.8rem + ((1vw - 0.32rem) * 1.0417)), 3.8rem)
 
H3 = clamp(2.4rem, calc(2.4rem + ((1vw - 0.32rem) * 0.8333)), 3.2rem)
 
H4 = clamp(2.2rem, calc(2.2rem + ((1vw - 0.32rem) * 0.625)), 2.8rem)
 
H5 = clamp(2rem, calc(2rem + ((1vw - 0.32rem) * 0.2083)), 2.2rem)
 
H6 = clamp(1.4rem, calc(1.4rem + ((1vw - 0.32rem) * 0.4167)), 1.8rem)
 
  
Oxygen > Templates > Edit Template > Manage > Settings > Global Styles > Body Text
+
=== Features ===
  
Font Size = clamp(1.4rem, calc(1.4rem + ((1vw - 0.32rem) * 0.4167)), 1.8rem)
+
https://wparena.com/oxygen-review/
  
https://www.youtube.com/watch?v=aO7QeE53Aqg
+
=== Purchase ===
  
===== Sections and Columns =====
+
https://oxygenbuilder.com/pricing
  
Oxygen > Templates > Edit Template > Manage > Settings > Global Styles > Sections and Columns
+
=== Installation ===
  
'''Section Container Padding'''
+
Plugins > Add New > Upload Plugin > Browse > Install Now
  
TOP = clamp(1rem, calc(1rem + ((1vw - 0.32rem) * 1.0417)), 2rem)
+
=== Documentation ===
BOTTOM = clamp(1rem, calc(1rem + ((1vw - 0.32rem) * 1.0417)), 2rem)
 
LEFT = 2rem
 
RIGHT = 2rem
 
  
'''Columns Padding'''
+
https://oxygenbuilder.com/documentation/
  
Delete all values then change to 'none'.
+
=== Changelog ===
  
https://www.youtube.com/watch?v=aO7QeE53Aqg
+
https://oxychangelog.com
  
===== Images =====
+
=== Support ===
  
SRCSET - The srcset attribute is giving the browser several different options to choose from depending on the size parameters. The browser will choose the smallest image that still matches the specified size parameters.
+
[https://app.slack.com/client/TAJ828N82/CAJ5461DH Slack - Oxygen Builder General Support]
  
Learn how to register custom image sizes in WordPress and use SRCSET functionality in Oxygen for fully responsive images...
+
[https://oxygenbuilder.com/support Oxygen - Official Support]
  
https://www.youtube.com/watch?v=0jc74V5wYRk
+
[https://github.com/soflyy/oxygen-bugs-and-features/issues Github - Oxygen Bugs and Features]
  
https://digitalambition.co/watch/responsive-srcset-images-in-oxygen-register-use-custom-sizes/
+
[https://ethereal-hugger-c87.notion.site/ACSS-Public-Roadmap-8534f74882584efe9f77777189ac75ca Roadmap]
  
https://creativesfeed.com/responsive-images-with-srcset/
+
=== Using Oxygen with Elementor ===
  
===== Miscellaneous =====
+
Yeah, I know, why the **** would you want to?  But, it's possible ...
  
https://oxywp.com/en/home-page/
+
Oxygen > Templates > New Template > Add Sections for header + main + footer, then in the main section add a Code Block with the PHP ...
  
==== Add-Ons ====
+
<?php the_content(); ?>
  
[https://www.cleanplugins.com/products/hydrogen-pack/ Hydrogen Pack - tweaks for Oxygen Builder]
+
... and then you can install the Elementor plugin, edit the page and watch as 100's of lines are added to your code :)
  
[https://oxyninja.com/core/ OxyNinja - Core Design and UI Set]
+
But, it's easy to use, right?
  
[https://oxymade.com/ OxyMade - Design Set and Framework for Oxygen Builder]
+
=== Tips ===
  
[https://isotropic.co/oxygen-builder-addons/ Oxygen Builder Addons]
+
==== Performance ====
  
[https://www.nimbufy.com/ Nimbufy - Bring any web page layout into Oxygen Builder]
+
Oxygen seems to load quicker in Mozilla Firefox.
  
[https://collaboration.oxyrealm.com/ Multi-User Collaboration]
+
https://oxygen4fun.supadezign.com/tips/useful-optimizations-for-oxygen-builder/
  
==== How To Clone A Template ====
+
==== Responsive ====
  
Under "Edit with Oxygen" you can click on shortcode and copy the content, then create a new template, click on shortcode, paste it and save it. Done.
+
NONE OF THIS IS NEEDED IF YOU BUY AND USE AUTOMATIC.CSS
  
== Google Analytics ==
 
  
=== Plugins ===
+
[https://websemantics.uk/tools/responsive-font-calculator/ Fluid Resposive Font Size Calculator]
  
[https://wordpress.org/plugins/simple-universal-google-analytics/ Simple Universal Google Analytics]
+
===== Fonts =====
  
[https://wordpress.org/plugins/google-analytics-dashboard-for-wp/ Google Analytics Dashboard for WP (GADWP)]
+
Before we get down to tweaking, here is the list of '''default settings''' for the Fonts in Global Styles:-
  
== Ecommerce - Shopify ==
+
'''Headings'''
 +
H1 - Font Size = 36px + Font Weight = 700
 +
H2 - Font Size = 30px
 +
H3 - Font Size = 24px
 +
H4 - Font Size = 20px
 +
H5 - Font Size = 18px
 +
H6 - Font Size = 16px
 +
 +
'''Body Text'''
 +
Text - Font Size = 16px + Font Weight = 400 + Line Height = 1.6 + Colour = #404040
  
https://www.shopify.com/buy-button/wordpress
+
'''CSS clamp()'''
  
https://www.shopify.co.uk/lite
+
CSS clamp is a function that sets responsive unit sizes without any media queries. The function takes 3 parameters in this order:
  
== Ecommerce - WooCommerce ==
+
# min - where to start scaling from.
 +
# viewport width - the range determines how fast the min scales to the max based on the screen getting larger.
 +
# max - when to stop scaling.
  
=== Setup Wizard ===
+
'''Add CSS'''
  
You can run the Setup Wizard, if you skipped it when installing WooCommerce. Go to: Help > Setup Wizard and select Setup Wizard.
+
Oxygen > Templates > Edit Template > Manage > Stylesheets > Add Stylesheet > Clamp
  
https://docs.woocommerce.com/document/woocommerce-setup-wizard/#section-6
+
/* Base */
 +
 +
html {
 +
  font-size: 62.5%;
 +
}
  
=== Categories ===
+
'''Add Clamp'''
  
https://atlantisthemes.com/woocommerce-categories/
+
Oxygen > Templates > Edit Template > Manage > Settings > Global Styles > Headings
  
=== Code Snippets ===
+
H1 = clamp(3.2rem, calc(3.2rem + ((1vw - 0.32rem) * 1.6667)), 4.8rem)
 +
H2 = clamp(2.8rem, calc(2.8rem + ((1vw - 0.32rem) * 1.0417)), 3.8rem)
 +
H3 = clamp(2.4rem, calc(2.4rem + ((1vw - 0.32rem) * 0.8333)), 3.2rem)
 +
H4 = clamp(2.2rem, calc(2.2rem + ((1vw - 0.32rem) * 0.625)), 2.8rem)
 +
H5 = clamp(2rem, calc(2rem + ((1vw - 0.32rem) * 0.2083)), 2.2rem)
 +
H6 = clamp(1.4rem, calc(1.4rem + ((1vw - 0.32rem) * 0.4167)), 1.8rem)
  
https://www.tychesoftwares.com/woocommerce-shop-page-hooks-visual-guide-with-code-snippets/
+
Oxygen > Templates > Edit Template > Manage > Settings > Global Styles > Body Text
  
=== Show Product Categories on Theme Menus ===
+
Font Size = clamp(1.4rem, calc(1.4rem + ((1vw - 0.32rem) * 0.4167)), 1.8rem)
  
Appearance > Menus > Screen Options (at top of page) > tick Product Categories
+
https://www.youtube.com/watch?v=aO7QeE53Aqg
  
==== Show Product Categories on Shop Page ====
+
===== Sections and Columns =====
  
# Click on Appearance > Customize
+
Oxygen > Templates > Edit Template > Manage > Settings > Global Styles > Sections and Columns
# Then go to WooCommerce > Product Catalog
 
# Select '''show categories''' from Shop Page Display
 
# Click on Save Changes
 
  
=== Customise Breadcrumb ===
+
Here are the '''default settings''' for Section and Columns in Oxygen Builder ...
 +
 +
'''Section Container Padding'''
 +
TOP = 75px
 +
BOTTOM = 75px
 +
LEFT = 20px
 +
RIGHT = 20px
 +
 +
'''Columns Padding'''
 +
TOP = 20px
 +
BOTTOM = 20px
 +
LEFT = 20px
 +
RIGHT = 20px
  
https://docs.woocommerce.com/document/customise-the-woocommerce-breadcrumb/
+
New values ...
  
=== Accompanying Plugins ===
+
'''Section Container Padding'''
  
[https://woocommerce.com/products/request-a-quote-plugin-for-woocommerce/ Request a Quote for WooCommerce]
+
TOP = clamp(1rem, calc(1rem + ((1vw - 0.32rem) * 1.0417)), 2rem)
 +
BOTTOM = clamp(1rem, calc(1rem + ((1vw - 0.32rem) * 1.0417)), 2rem)
 +
LEFT = 2rem
 +
RIGHT = 2rem
  
[https://woocommercequoteplugin.com/requestforquote/woocommerce-quotation-plugin/ WooCommerce Quotation / Request For Quote Plugin]
+
'''Columns Padding'''
  
[https://wordpress.org/plugins/yith-woocommerce-request-a-quote/ Request A Quote]
+
Delete all values then change to 'none'.
  
=== Shortcodes ===
+
https://www.youtube.com/watch?v=aO7QeE53Aqg
  
WooCommerce cannot function properly without the first three shortcodes being somewhere on your site.
+
===== Images =====
  
[woocommerce_cart] – shows the cart page
+
SRCSET - The srcset attribute is giving the browser several different options to choose from depending on the size parameters. The browser will choose the smallest image that still matches the specified size parameters.
[woocommerce_checkout] – shows the checkout page
 
[woocommerce_my_account] – shows the user account page
 
[woocommerce_order_tracking] – shows the order tracking form
 
  
https://docs.woocommerce.com/document/woocommerce-shortcodes/
+
Learn how to register custom image sizes in WordPress and use SRCSET functionality in Oxygen for fully responsive images...
  
=== Custom Related Products ===
+
https://www.youtube.com/watch?v=0jc74V5wYRk
  
https://wordpress.org/plugins/custom-related-products-for-woocommerce/
+
https://digitalambition.co/watch/responsive-srcset-images-in-oxygen-register-use-custom-sizes/
  
=== Google Products Integration ===
+
https://creativesfeed.com/responsive-images-with-srcset/
  
https://woocommerce.com/products/google-listings-and-ads/
+
===== Sticky Shrinking Header =====
  
https://www.searchenginejournal.com/google-integrates-with-woocommerce-for-easy-product-uploads/410082/amp/
+
https://isotropic.co/sticky-shrinking-header-in-oxygen-builder-that-hides-on-scroll-down/
  
== Media Queries Screen Sizes List ==
+
===== Miscellaneous =====
  
/* Set the background color of body to tan */
+
https://oxywp.com/en/home-page/
body {
 
  background-color: tan;
 
}
 
 
/* On screens that are 992px or less, set the background color to blue */
 
@media screen and (max-width: 992px) {
 
  body {
 
    background-color: blue;
 
  }
 
}
 
 
/* On screens that are 600px or less, set the background color to olive */
 
@media screen and (max-width: 600px) {
 
  body {
 
    background-color: olive;
 
  }
 
}
 
  
[https://www.w3schools.com/css/css3_mediaqueries_ex.asp CSS Media Queries - More Examples]
+
==== Tags and Lists ====
  
This is a list of the known screen sizes so that you can customise your CSS for mobile devices.
+
[https://editorenhancer.com/basic-component-lists-in-oxygen/ Basic Component Lists in Oxygen Builder]
  
For example, a Google Pixel...
+
==== Add-Ons ====
 +
 
 +
===== Automatic CSS =====
 +
 
 +
Automatic.css is the Most Practical, No-Nonsense Utility Framework Ever Created for Oxygen Builder.
 +
 
 +
* Automatic Typography
 +
* Automatic Colours
 +
* Automatic Spacing
 +
 
 +
[https://youtu.be/coTPKWrgIhQ?t=221 Automatic CSS - Tweak Oxygen Before Install]
 +
 
 +
[https://automaticcss.com/ Automatic CSS - Home Page]
 +
 
 +
[https://automaticcss.com/changelog/ Automatic CSS - Changelog]
 +
 
 +
[https://community.automaticcss.com/c/setup/ Automatic CSS - Setup]
 +
 
 +
'''Holding Page'''
 +
 
 +
Floating logo...
  
@media screen
+
Add > Div > center--all , height--full , pad--m
  and (device-width: 360px)
 
  and (device-height: 640px)
 
  and (-webkit-device-pixel-ratio: 3)
 
  and (orientation: portrait) {
 
 
}
 
  
https://css-tricks.com/snippets/css/media-queries-for-standard-devices/
+
<nowiki><div id="div_block-2-10" class="ct-div-block center--all height--full pad--m" ></nowiki>
  
=== Test Pages ===
+
'''Negative Values'''
  
Resize you browser window and watch the magic happen...
+
margin-top: calc(var(--space-xxl) * -1);
  
https://www.w3schools.com/cssref/tryit.asp?filename=trycss3_media_bg
+
===== Recoda WorkSpace =====
<!DOCTYPE html>
 
<html>
 
<head>
 
<meta name="viewport" content="width=device-width, initial-scale=1.0">
 
<style>
 
body {
 
  background-color: yellow;
 
}
 
@media only screen and (max-width: 600px) {
 
  body {
 
    background-color: lightblue;
 
  }
 
}
 
</style>
 
</head>
 
<body>
 
<nowiki><h1>The @media Rule</h1></nowiki>
 
<p>Resize the browser window. When the width of this document is 600 pixels or less, the background-color is "lightblue", otherwise it is "yellow".</p>
 
</body>
 
</html>
 
  
== Menu Descriptions ==
+
[https://recoda.me/ Recoda WorkSpace for Oxygen Builder] | [https://docs.recoda.me/getting-started/features-overview Getting Started] | [https://recoda.me/changelog/ Changelog]
  
https://www.wpbeginner.com/wp-themes/how-to-add-menu-descriptions-in-your-wordpress-themes/
+
'''Command Line'''
  
== Custom PHP Code ==
+
<nowiki>section@Name#id'tag.class</nowiki>
  
Paste the PHP code into your theme's file:
+
Install the Recoda plugin, start a new Template, press g on your keyboard, paste any of these lines and press enter ...
  
<?php
+
HEADER
echo do_shortcode('[smartslider3 slider=1]');
 
?>
 
  
== Disable Avatars Gravatar ==
+
<nowiki>section@Header#header'header.header</nowiki>
  
Every page load will try to contact gravatar.com to load a user's avatar. To speed things up, disable avatars...
+
MAIN
  
  Settings > Discussion > untick Show Avatars > Save Settings > Log Out
+
  <nowiki>section@Main#main'main.main</nowiki>
  
== Make Twenty Nineteen Full Width ==
+
FOOTER
  
https://benjaminintal.com/2018/12/11/how-to-make-twenty-nineteens-content-full-width/
+
<nowiki>section@Footer#footer'footer.footer</nowiki>
  
== Responsive CSS Templates ==
+
ALL 3 SECTIONS TOGETHER
  
https://www.w3schools.com/css/css_rwd_templates.asp
+
<nowiki>section@Header#header'header.header+section@Main#main'main.main+section@Footer#footer'footer.footer</nowiki>
  
== Simple One Page Theme ==
+
COMPLEX FOOTER WITH 3 COLUMNS
  
https://www.famethemes.com/themes/onepress/
+
<nowiki>section@Footer#footer'footer.footer.grid--3.pad-section--xs.grid--m-1.gap--l>div>txt{Lorem ipsum dolor sit amet. Id magnam sint et inventore temporibus non soluta aperiam est quos tempora sed galisum quia.}^1*3</nowiki>
  
https://raratheme.com/wordpress-themes/business-one-page/
+
===== Others =====
  
https://demo.themegrill.com/flash-one-page/
+
'''[https://www.altmann.de/en/blog-en/code-snippet-edit-oxygen-stylesheets-outside-builder/ Edit CSS Outside Oxygen]''' - for this, install WP Code Snippets > Add New > Custom > Type: PHP > Paste PHP Code > Save > Activate
  
https://www.inkthemesdemo.com/wptheme/free-one-page-wordpress-theme/
+
[https://oxyprops.com/ OxyProps - CSS Custom Properties right in Oxygen Builder]
 +
 
 +
[https://oxyextras.com/ OxyExtras]
 +
 
 +
[https://www.cleanplugins.com/products/hydrogen-pack/ Hydrogen Pack - tweaks for Oxygen Builder]
  
== Nice Themes ==
+
[https://oxyninja.com/core/ OxyNinja - Core Design and UI Set]
  
[https://wordpress.org/themes/astra/ Astra]
+
'''[https://oxyninja.com/core-framework-cheatsheet/ OxyNinja Framework Cheatsheet]'''
  
[https://demos.qreativethemes.com/physio/ Pysio]
+
[https://oxymade.com/ OxyMade - Design Set and Framework for Oxygen Builder]
  
== Google Fonts ==
+
[https://isotropic.co/oxygen-builder-addons/ Oxygen Builder Addons]
  
[https://fontsplugin.com/wordpress-google-fonts/ Google Fonts Plugin]
+
[https://www.nimbufy.com/ Nimbufy - Bring any web page layout into Oxygen Builder]
  
[https://wordpress.org/plugins/host-google-fonts-locally/ Host Google Fonts Locally]
+
[https://collaboration.oxyrealm.com/ Multi-User Collaboration]
  
== Security Scan ==
+
==== How To Install Analytics Using Code Snippets ====
  
https://wpscans.com
+
https://wordpress.org/plugins/code-snippets/
  
== FTP Details ==
+
Dashboard > Snippets > '''Add New''' >
  
'''NEWEST'''
+
add_action( 'wp_head', 'matomo_analytics' );
 +
/**
 +
  * Adds Matomo Analytics code in <head> below the <title>.
 +
  */
 +
function matomo_analytics() { ?>
 +
 +
<!-- Matomo -->
 +
<script>
 +
  var _paq = window._paq = window._paq || [];
 +
  /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
 +
  _paq.push(['trackPageView']);
 +
  _paq.push(['enableLinkTracking']);
 +
  (function() {
 +
    var u="<nowiki>https://matomo.domain.uk/</nowiki>";
 +
    _paq.push(['setTrackerUrl', u+'matomo.php']);
 +
    _paq.push(['setSiteId', '24']);
 +
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
 +
    g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
 +
  })();
 +
</script>
 +
<!-- End Matomo Code -->
 +
 +
<?php }
  
'''FEBRUARY 2021 - FIX FOR FTP CHROOT'''
+
https://permaslug.com/how-to-install-google-analytics-in-wordpress/
  
New tweak = put the chroot'd path to the base, content and plugin directories.
+
==== How To Clone A Template ====
  
Also, use the 'ftpsockets' method.
+
Under "Edit with Oxygen" you can click on shortcode and copy the content, then create a new template, click on shortcode, paste it and save it. Done.
  
/** FTP Tweaks */
+
==== How To Copy An Entire Web Site ====
define('FS_METHOD', 'ftpsockets');
 
define('FTP_SSL', 'false');
 
define('FTP_HOST', '123.456.789.0:21');
 
define('FTP_USER', 'username');
 
define('FTP_PASS', 'password');
 
define('FTP_BASE', '/html/');
 
define('FTP_CONTENT_DIR', '/html/wp-content/');
 
define('FTP_PLUGIN_DIR ', '/html/wp-content/plugins/');
 
  
NEWISH
+
To copy an entire WordPress install with all of your content, plugins, settings, and everything else, you can use a plugin like All-in-One WP Migration.
  
/** FTP Tweaks */
+
Once you've created a .wpress package with All-in-One WP Migration, import the package on the target site and do the following:
define('FS_METHOD', 'ftpext');
 
define('FTP_HOST', 'ftp.example.org');
 
define('FTP_USER', 'username');
 
define('FTP_PASS', 'password');
 
define('FTP_BASE', '/path/to/wordpress/');
 
  
Full list of FTP variables...
+
# Save your permalinks twice via '''Settings > Permalinks'''
 +
# Resign your shortcodes via '''Oxygen > Settings > Security'''
 +
# Regenerate your CSS cache via '''Oxygen > Settings > CSS Cache'''
 +
# Check to verify that everything looks and works as you expect
  
define('FS_METHOD', 'ftpext');
+
You may also need to open each template in the admin area and click the Update button on the right-hand side, but this is rare if you have followed the above steps.
define('FTP_BASE', '/path/to/wordpress/');
 
define('FTP_CONTENT_DIR', '/path/to/wordpress/wp-content/');
 
define('FTP_PLUGIN_DIR ', '/path/to/wordpress/wp-content/plugins/');
 
define('FTP_PUBKEY', '/home/username/.ssh/id_rsa.pub');
 
define('FTP_PRIKEY', '/home/username/.ssh/id_rsa');
 
define('FTP_USER', 'username');
 
define('FTP_PASS', 'password');
 
define('FTP_HOST', 'ftp.example.org');
 
define('FTP_SSL', false);
 
  
https://wordpress.org/support/article/editing-wp-config-php/
+
https://oxygenbuilder.com/documentation/other/importing-exporting/
  
== Version 5 Gutenberg Editor ==
+
==== Custom Fonts ====
  
https://wordpress.org/gutenberg/handbook/designers-developers/
+
https://www.youtube.com/watch?v=3pqOKtdiCTM
  
== About Page ==
+
==== Dark Mode ====
  
https://www.domain.com/wp-admin/about.php
+
https://www.youtube.com/watch?v=CzfP3-xwoiM
  
== Hacking ==
+
[https://gist.githubusercontent.com/Spellhammer/e2e10505bae92e885aa5e43abf1c4ba2/raw/f8a5f3a6fb51551aa585386e0bcd90b503f2c950/alpinedarkmodetoggle.html Paste this in to a Code Block]
  
[https://github.com/wpscanteam/wpscan WPscan - Open Source WordPress scanner]
+
https://smoothwebsites.net/tutorials/how-to-implement-a-dark-mode-toggle-in-oxygen/
  
[https://hackertarget.com/attacking-wordpress/ Attacking WordPress - /readme.html]
+
https://permaslug.com/dark-mode-in-oxygen/
 +
 
 +
== Google Analytics ==
 +
 
 +
=== Plugins ===
 +
 
 +
[https://wordpress.org/plugins/simple-universal-google-analytics/ Simple Universal Google Analytics]
 +
 
 +
[https://wordpress.org/plugins/google-analytics-dashboard-for-wp/ Google Analytics Dashboard for WP (GADWP)]
  
[https://sitecheck.sucuri.net Hack Check]
+
== Ecommerce - Shopify ==
  
[https://www.wpbeginner.com/beginners-guide/reasons-why-wordpress-site-gets-hacked/ 11 Top Reasons Why WordPress Sites Get Hacked (and How to Prevent it)]
+
https://www.shopify.com/buy-button/wordpress
  
[https://www.ceos3c.com/hacking/how-to-hack-a-wordpress-website/ How To Hack A WordPress Web Site]
+
https://www.shopify.co.uk/lite
  
== WordPress Releases ==
+
== Ecommerce - WooCommerce ==
  
https://wordpress.org/download/releases/
+
=== How to create more than 50 product variations in WooCommerce ===
  
== WordPress Releases and PHP Requirements ==
+
define( 'WC_MAX_LINKED_VARIATIONS', 100 );
  
[https://make.wordpress.org/core/handbook/references/php-compatibility-and-wordpress-versions/ PHP Compatibility and WordPress Versions]
+
https://www.proy.info/create-more-than-50-product-variations-in-woocommerce/
  
== WordPress with Lighttpd ==
+
=== Hide Downloads Tab on My Account page ===
  
=== Installation ===
+
Dashboard > WooCommerce > Settings > Advanced > Account Endpoints > delete the text in the 'downloads' box
  
need to add
+
''Account endpoints - Endpoints are appended to your page URLs to handle specific actions on the accounts pages. They should be unique and '''can be left blank to disable the endpoint'''.''
  
* add php repo
+
=== Products Sorting ===
* add mysql repo
 
* add extra php modules for new 'site health' ('''php7.3-bcmath''', '''php-imagick''')
 
  
https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions
+
[https://www.pootlepress.com/2021/03/change-default-woocommerce-product-sorting/ How to Change Default WooCommerce Product Sorting]
  
sudo -i
+
# Method one – use the customise setting to change default product sorting
apt-get install lighttpd php-cgi php-mysql mysql-server
+
# Method two – Drag and Drop product sorting
lighty-enable-mod fastcgi
 
lighty-enable-mod fastcgi-php
 
wget -O wordpress-latest.tar.gz <nowiki>http://wordpress.org/latest.tar.gz</nowiki>
 
tar --strip-components=1 -xzvf wordpress-latest.tar.gz -C /var/www/domain.co.uk/html/
 
cd /var/www/domain.co.uk/html
 
mv wp-config-sample.php wp-config.php
 
chown -R ftpuser1:www-data .
 
find . -type f -exec chmod 664 {} +
 
find . -type d -exec chmod 775 {} +
 
chmod 660 wp-config.php
 
  
https://www.smashingmagazine.com/2014/05/proper-wordpress-filesystem-permissions-ownerships
+
=== Add Customers ===
  
=== FIXES THE RECENT WORDPRESS 5 BUG OF NOT SAVING PAGES ===
+
https://fluentsmtp.com/manually-add-customers-to-woocommerce/
  
$HTTP["host"] =~ "domain.co.uk" {
+
=== Setup Wizard ===
  '''url.rewrite-if-not-file''' = (
 
  # Exclude directories
 
  "^/(wp-admin|wp-includes|wp-content|gallery2|.well-known)/(.*)" => "$0",
 
  # Exclude root php files
 
  "^/(.*.php)" => "$0",
 
  # Handle permalinks and feeds
 
  "^/(.*)$" => "/index.php/$1"
 
  )
 
}
 
  
== WordPress with NginX ==
+
You can run the Setup Wizard, if you skipped it when installing WooCommerce. Go to: Help > Setup Wizard and select Setup Wizard.
  
https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-ubuntu-20-04
+
https://docs.woocommerce.com/document/woocommerce-setup-wizard/#section-6
  
https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-lemp-on-ubuntu-18-04
+
=== Categories ===
  
NOTES
+
https://atlantisthemes.com/woocommerce-categories/
  
sudo apt-get install nano
+
=== Code Snippets ===
sudo apt-get install nginx
 
sudo apt-get install mysql-server
 
sudo mysql_secure_installation
 
sudo apt-get install php-fpm php-mysql
 
sudo apt-get install php-curl php-gd php-mbstring php-xml php-xmlrpc
 
sudo apt-get install curl
 
  
https://www.techrepublic.com/article/how-to-install-mcrypt-for-php-7-2/
+
https://www.tychesoftwares.com/woocommerce-shop-page-hooks-visual-guide-with-code-snippets/
  
=== Tuning Performance ===
+
=== Hide Product Count ===
  
[https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-with-http-2-support-on-ubuntu-16-04 HTTP/2 with nginX]
+
.woocommerce-result-count {
 +
  display: none;
 +
}
  
https://mmoapi.com/post/tuning-nginx-php-fpm-and-system-sysctl-to-increase-website-performance
+
=== Show Arrow On Drop-Down Sorting Menu On Product Pages ===
  
=== Sitemaps ===
+
.breakdance-woocommerce select {
 +
  -moz-appearance: auto;
 +
  -webkit-appearance: auto;
 +
  appearance: auto;
 +
  height: auto;
 +
  width: auto;
 +
}
  
# Rewrites for Yoast SEO XML Sitemap
+
=== Show Product Categories on Theme Menus ===
rewrite ^/sitemap_index.xml$ /index.php?sitemap=1 last;
 
rewrite ^/([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
 
  
https://yoast.com/help/xml-sitemaps-nginx/
+
Appearance > Menus > Screen Options (at top of page) > tick Product Categories
  
=== Rest API Fix ===
+
=== Show Product Categories on Shop Page ===
  
This seems to be a NginX bug with the Gutenberg Editor and is part of the Tools > Site Health error "REST API is not working correctly."
+
# Click on Appearance > Customize
 +
# Then go to WooCommerce > Product Catalog
 +
# Select '''show categories''' from Shop Page Display
 +
# Click on Save Changes
  
Change all your lines with this...
+
=== Customise Breadcrumb ===
  
try_files $uri $uri/ /index.php;
+
https://docs.woocommerce.com/document/customise-the-woocommerce-breadcrumb/
  
To this...
+
=== Accompanying Plugins ===
  
try_files $uri $uri/ /index.php$is_args$args;
+
[https://woocommerce.com/products/request-a-quote-plugin-for-woocommerce/ Request a Quote for WooCommerce]
  
Restart NginX and PHP FPM...
+
[https://woocommercequoteplugin.com/requestforquote/woocommerce-quotation-plugin/ WooCommerce Quotation / Request For Quote Plugin]
  
sudo systemctl restart php7.4-fpm.service nginx.service
+
[https://wordpress.org/plugins/yith-woocommerce-request-a-quote/ Request A Quote]
  
https://developer.wordpress.org/rest-api/frequently-asked-questions/#query-parameters-are-not-working
+
=== Shortcodes ===
  
== Registration Page ==
+
WooCommerce cannot function properly without the first three shortcodes being somewhere on your site.
  
  /wp-login.php?action=register
+
  [woocommerce_cart] – shows the cart page
 +
[woocommerce_checkout] – shows the checkout page
 +
[woocommerce_my_account] – shows the user account page
 +
[woocommerce_order_tracking] – shows the order tracking form
  
== Backup ==
+
https://docs.woocommerce.com/document/woocommerce-shortcodes/
  
https://managewp.com/features/backup
+
=== Custom Related Products ===
  
https://websitesetup.org/wordpress-backup/
+
https://wordpress.org/plugins/custom-related-products-for-woocommerce/
  
== WordPress Site Management ==
+
=== Google Products Integration ===
  
https://mainwp.com/features/
+
https://woocommerce.com/products/google-listings-and-ads/
  
== WordPress MultiSite ==
+
https://www.searchenginejournal.com/google-integrates-with-woocommerce-for-easy-product-uploads/410082/amp/
  
https://premium.wpmudev.org/blog/ultimate-guide-multisite/
+
=== Command Line Updating Database ===
  
=== Network Activate Plugins ===
+
This will update the WooCommerce database using wp-cli on a WordPress Multisite install...
  
On a WordPress multisite, only Super Admins can install plugins. After the installation, super admins have these options...
+
<nowiki>export WP_CLI_CACHE_DIR=/var/www/domain.co.uk/.wp-cli/cache; sudo -u www-data -E wp --path='/var/www/domain.co.uk/html/' --url='https://sub.domain.co.uk/' wc update</nowiki>
  
# Network Activate – Using this option super admins can activate a plugin across the network.
+
=== Square Payment Plug-In ===
# Activate – They can also activate a plugin for the main/root site.
 
# Individual Sites – Lastly they can allow individual site administrators to activate plugins themselves.
 
  
When you log in to your WordPress multisite's main site, you will be able to see two different plugins screen.
+
The Square Digital Wallet option for WooCommerce is lovely and all, but it means you can get around the Order Limit plug-in.
 
 
The first one is on the main admin sidebar. It is for plugins installed and available for activation on your main site.
 
 
 
The second plugins screen is located under My Sites » Network Admin » Plugins. This is where you will install new plugins and manage them for the entire network.
 
 
 
https://www.wpbeginner.com/beginners-guide/should-you-network-activate-all-plugins-on-wordpress-multisite/
 
  
'''Add Plugins Menu for Child Sites in WordPress Multisite'''
+
The fix?
  
To enable plugin’s menu for individual sites, you need to switch to Network Admin dashboard.
+
Install the WPCode Lite plug-in then add a PHP Snippet called 'WooCommerce Square Hide Digital Wallet' with this code in it ...
  
Switching to network admin dashboard
+
add_filter( 'wc_square_display_digital_wallet_on_pages', function( $pages ) {
 +
    return array(
 +
        /* 'product', // Don't show Apple Pay and Google Pay on product pages */
 +
        /* 'cart', */
 +
        'checkout',
 +
    );
 +
}, 10, 1 );
  
On the network admin dashboard, visit Settings » Network Settings. Scroll down to the bottom of the page and you will see the checkbox to enable plugins menu.
+
[https://stackoverflow.com/questions/73477688/removing-square-google-pay-from-certain-product-pages-in-woocommerce Removing Square Google Pay from Certain Product Pages in WooCommerce]
  
=== WP CLI ===
+
=== Analytics ===
  
Show list of sites...
+
==== Analytics Section Not Showing ====
  
export WP_CLI_CACHE_DIR=/var/www/domain.co.uk/.wp-cli/cache; sudo -u www-data -E wp --path='/var/www/domain.co.uk/html/' site list
+
Go to https://www.yoursite.com/wp-admin/options.php and look for the option '''woocommerce_analytics_enabled''' and change it to ''yes'' then click SAVE CHANGES.
  
Show options for a multisite site...
+
== Media Queries Screen Sizes List ==
  
  export WP_CLI_CACHE_DIR=/var/www/domain.co.uk/.wp-cli/cache; sudo -u www-data -E wp --path='/var/www/domain.co.uk/html/' --url='<nowiki>http://mysubdomain.domain.co.uk/</nowiki>' option get siteurl
+
  /* Set the background color of body to tan */
 +
body {
 +
  background-color: tan;
 +
}
 +
 +
/* On screens that are 992px or less, set the background color to blue */
 +
@media screen and (max-width: 992px) {
 +
  body {
 +
    background-color: blue;
 +
  }
 +
}
 +
 +
/* On screens that are 600px or less, set the background color to olive */
 +
@media screen and (max-width: 600px) {
 +
  body {
 +
    background-color: olive;
 +
  }
 +
}
  
Change option for a multisite site...
+
[https://www.w3schools.com/css/css3_mediaqueries_ex.asp CSS Media Queries - More Examples]
  
export WP_CLI_CACHE_DIR=/var/www/domain.co.uk/.wp-cli/cache; sudo -u www-data -E wp --path='/var/www/domain.co.uk/html/' --url='<nowiki>http://mysubdomain.domain.co.uk/</nowiki>' option update siteurl '<nowiki>http://mysubdomain.domain.com</nowiki>'
+
This is a list of the known screen sizes so that you can customise your CSS for mobile devices.
  
=== Help With Making Changes ===
+
For example, a Google Pixel...
  
https://www.siteground.com/kb/change-domain-wordpress-multisite/
+
@media screen
 +
  and (device-width: 360px)
 +
  and (device-height: 640px)
 +
  and (-webkit-device-pixel-ratio: 3)
 +
  and (orientation: portrait) {
 +
 +
}
  
== Move Posts To Different Types ==
+
https://css-tricks.com/snippets/css/media-queries-for-standard-devices/
  
* Posts to Pages
+
=== Test Pages ===
* Pages to Posts
 
* Default Post Type to Custom Post Type
 
  
http://wordpress.org/extend/plugins/post-type-switcher/
+
Resize you browser window and watch the magic happen...
  
== Custom Post Types and Categories and Taxonomies ==
+
https://www.w3schools.com/cssref/tryit.asp?filename=trycss3_media_bg
 +
<!DOCTYPE html>
 +
<html>
 +
<head>
 +
<meta name="viewport" content="width=device-width, initial-scale=1.0">
 +
<style>
 +
body {
 +
  background-color: yellow;
 +
}
 +
@media only screen and (max-width: 600px) {
 +
  body {
 +
    background-color: lightblue;
 +
  }
 +
}
 +
</style>
 +
</head>
 +
<body>
 +
<nowiki><h1>The @media Rule</h1></nowiki>
 +
<p>Resize the browser window. When the width of this document is 600 pixels or less, the background-color is "lightblue", otherwise it is "yellow".</p>
 +
</body>
 +
</html>
  
https://www.wpbeginner.com/wp-tutorials/how-to-exportimport-custom-post-types-in-wordpress/
+
== Menu Descriptions ==
  
https://www.wpbeginner.com/wp-tutorials/how-to-add-categories-to-a-custom-post-type-in-wordpress/
+
https://www.wpbeginner.com/wp-themes/how-to-add-menu-descriptions-in-your-wordpress-themes/
  
== Import Posts with Images ==
+
== Custom PHP Code ==
  
https://wordpress.org/plugins/export-featured-images/
+
Paste the PHP code into your theme's file:
  
https://kellenmace.com/include-featured-images-with-posts-using-wordpress-exportimport-tool/
+
<?php
 +
echo do_shortcode('[smartslider3 slider=1]');
 +
?>
  
https://wordpress.stackexchange.com/questions/257180/how-to-import-wordpress-posts-with-images-from-one-wordpress-site-to-another
+
== Disable Avatars Gravatar ==
  
== HOWTO: Create Folders Within Media Library ==
+
Every page load will try to contact gravatar.com to load a user's avatar. To speed things up, disable avatars...
  
https://maxgalleria.com/add-organize-media-library-folders/
+
Settings > Discussion > untick Show Avatars > Save Settings > Log Out
  
https://wordpress.org/plugins/media-library-plus/
+
== Make Twenty Nineteen Full Width ==
  
== HOWTO: Download Older Versions of WordPress Plugins ==
+
https://benjaminintal.com/2018/12/11/how-to-make-twenty-nineteens-content-full-width/
  
https://kinsta.com/knowledgebase/download-older-versions-of-wordpress-plugins/
+
== Responsive CSS Templates ==
  
== HOWTO: Increase PHP Memory Limit (UpdraftPlus Error) ==
+
https://www.w3schools.com/css/css_rwd_templates.asp
  
https://updraftplus.com/faqs/deal-fatal-error-allowed-memory-size-errors/
+
== Simple One Page Theme ==
  
== HOWTO: Disable wp-cron.php WP_CRON ==
+
https://www.famethemes.com/themes/onepress/
  
WordPress uses a file called wp-cron.php as a virtual cron job, or scheduled task in order to automate things like publishing scheduled posts, checking for plugin or theme updates, sending email notifications and more.
+
https://raratheme.com/wordpress-themes/business-one-page/
  
By default WordPress is set up to call wp-cron.php every time someone visits your WordPress website when a scheduled task is present, to basically ask "is it time to do anything yet?".
+
https://demo.themegrill.com/flash-one-page/
 +
 
 +
https://www.inkthemesdemo.com/wptheme/free-one-page-wordpress-theme/
  
On low traffic sites this is perfectly fine, but when visitors roll in, checking multiple times for scheduled tasks can be very inefficient and lead to resource usage problems for your server, plus make your website load slower.
+
== Nice Themes ==
  
To fix this, change the following setting in your '''wp-config.php''' file...
+
[https://wordpress.org/themes/astra/ Astra]
  
define('DISABLE_WP_CRON', true);
+
[https://demos.qreativethemes.com/physio/ Pysio]
  
Then, create a cron job to call the script...
+
== Google Fonts ==
  
crontab -e
+
[https://fontsplugin.com/wordpress-google-fonts/ Google Fonts Plugin]
@hourly cd /var/www/website.co.uk/html/ && sudo -u www-data php wp-cron.php
 
  
or
+
[https://wordpress.org/plugins/host-google-fonts-locally/ Host Google Fonts Locally]
  
@hourly curl --silent https://www.website.co.uk/wp-cron.php?doing_wp_cron
+
== Security Scan ==
  
Thanks - https://www.inmotionhosting.com/support/website/wordpress/disabling-the-wp-cronphp-in-wordpress
+
https://wpscans.com
  
== HOWTO: Disable WordPress User Account ==
+
== FTP Details ==
  
* Method 1 - change the user's role to 'No Role For This Site'
+
'''NEWEST'''
* Method 2 - install the [https://wordpress.org/plugins/disable-users/ Disable Users Plugin] and disable that user.
 
  
Thanks - https://9seeds.com/how-to-disable-wordpress-user-accounts/
+
'''FEBRUARY 2021 - FIX FOR FTP CHROOT'''
  
== Hide Page Title On Home Page Only ==
+
New tweak = put the chroot'd path to the base, content and plugin directories.
  
body.home header.entry-header {
+
Also, use the 'ftpsockets' method.
  display: none;
 
}
 
  
== HOWTO: Hide Page Title Per Basis ==
+
/** FTP Tweaks */
 +
define('FS_METHOD', 'ftpsockets');
 +
define('FTP_SSL', 'false');
 +
define('FTP_HOST', '123.456.789.0:21');
 +
define('FTP_USER', 'username');
 +
define('FTP_PASS', 'password');
 +
define('FTP_BASE', '/html/');
 +
define('FTP_CONTENT_DIR', '/html/wp-content/');
 +
define('FTP_PLUGIN_DIR ', '/html/wp-content/plugins/');
  
'''style.css'''
+
NEWISH
  
  .page-id-1826 .entry-title {display: none;}
+
  /** FTP Tweaks */
 +
define('FS_METHOD', 'ftpext');
 +
define('FTP_HOST', 'ftp.example.org');
 +
define('FTP_USER', 'username');
 +
define('FTP_PASS', 'password');
 +
define('FTP_BASE', '/path/to/wordpress/');
  
Thanks - https://premium.wpmudev.org/blog/wordpress-hide-page-title-or-post-title-on-a-case-by-case-basis/
+
Full list of FTP variables...
  
== HOWTO: Download Latest Version ==
+
define('FS_METHOD', 'ftpext');
 
+
define('FTP_BASE', '/path/to/wordpress/');
  wget -O wordpress-latest.tar.gz <nowiki>http://wordpress.org/latest.tar.gz</nowiki>
+
  define('FTP_CONTENT_DIR', '/path/to/wordpress/wp-content/');
 +
define('FTP_PLUGIN_DIR ', '/path/to/wordpress/wp-content/plugins/');
 +
define('FTP_PUBKEY', '/home/username/.ssh/id_rsa.pub');
 +
define('FTP_PRIKEY', '/home/username/.ssh/id_rsa');
 +
define('FTP_USER', 'username');
 +
define('FTP_PASS', 'password');
 +
define('FTP_HOST', 'ftp.example.org');
 +
define('FTP_SSL', false);
  
== HOWTO: Update Admin User Password Command Line ==
+
https://wordpress.org/support/article/editing-wp-config-php/
  
mysql -u root -p wordpress_database -e "UPDATE wp_users SET user_pass=MD5('MyNewPassword') WHERE ID='1';"
+
== Version 5 Gutenberg Editor ==
  
== HOWTO: Extract WordPress Without First Directory ==
+
https://wordpress.org/gutenberg/handbook/designers-developers/
  
sudo tar --strip-components=1 -xzvf latest.tar.gz -C /path/to/directory/
+
== About Page ==
  
e.g.
+
https://www.domain.com/wp-admin/about.php
  
sudo tar --strip-components=1 -xzvf latest.tar.gz -C /var/www/domain.com/html/
+
== Hacking ==
  
== HOWTO: Correct Ownership And Permissions Of BITNAMI Wordpress Files ==
+
[https://github.com/wpscanteam/wpscan WPscan - Open Source WordPress scanner]
  
sudo chown -R daemon:daemon /opt/bitnami/apps/wordpress/htdocs
+
[https://hackertarget.com/attacking-wordpress/ Attacking WordPress - /readme.html]
sudo find /opt/bitnami/apps/wordpress/htdocs -type d -exec chmod 755 {} \;
 
sudo find /opt/bitnami/apps/wordpress/htdocs -type f -exec chmod 644 {} \;
 
sudo /opt/bitnami/ctlscript.sh restart apache
 
sudo /opt/bitnami/ctlscript.sh restart php-fpm
 
  
https://morganhvidt.com/fix-permissions-wordpress-bitnami-gcp/
+
[https://sitecheck.sucuri.net Hack Check]
  
== HOWTO: Install Different PHP Modules on BITNAMI WordPress ==
+
[https://www.wpbeginner.com/beginners-guide/reasons-why-wordpress-site-gets-hacked/ 11 Top Reasons Why WordPress Sites Get Hacked (and How to Prevent it)]
  
Bitnami stacks already include a number of PHP modules, which are installed but not active. Before installing a new module, check that it is not already included. If it exists, simply enable it in the PHP configuration file.
+
[https://www.ceos3c.com/hacking/how-to-hack-a-wordpress-website/ How To Hack A WordPress Web Site]
  
=== Imagick ===
+
== WordPress Releases ==
  
The Imagick module is installed in Bitnami stacks, but is not enabled by default. To enable it, follow these steps:
+
https://wordpress.org/download/releases/
  
Uncomment or add the following line to the /opt/bitnami/php/etc/php.ini file:
+
== WordPress Releases and PHP Requirements ==
  
...
+
[https://make.wordpress.org/core/handbook/references/php-compatibility-and-wordpress-versions/ PHP Compatibility and WordPress Versions]
extension=imagick.so
 
...
 
  
Restart the Apache server and/or the PHP-FPM service (if available):
+
== WordPress with Lighttpd ==
  
sudo /opt/bitnami/ctlscript.sh restart apache
+
=== Installation ===
sudo /opt/bitnami/ctlscript.sh restart php-fpm
 
  
[https://docs.bitnami.com/aws/apps/wordpress/configuration/install-modules-php/ Thanks]
+
need to add
  
==  HOWTO: Correct Ownership And Permissions Of Wordpress Files ==
+
* add php repo
 +
* add mysql repo
 +
* add extra php modules for new 'site health' ('''php7.3-bcmath''', '''php-imagick''')
  
You need to make the user the FTP login and the group the user Apache or Lighttpd runs as...
+
https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions
  
  sudo chown -R fred:www-data /var/www/fred.com/html/
+
  sudo -i
 
+
apt-get install lighttpd php-cgi php-mysql mysql-server
Change to the correct directory...
+
lighty-enable-mod fastcgi
 +
lighty-enable-mod fastcgi-php
 +
wget -O wordpress-latest.tar.gz <nowiki>http://wordpress.org/latest.tar.gz</nowiki>
 +
tar --strip-components=1 -xzvf wordpress-latest.tar.gz -C /var/www/domain.co.uk/html/
 +
cd /var/www/domain.co.uk/html
 +
mv wp-config-sample.php wp-config.php
 +
chown -R ftpuser1:www-data .
 +
find . -type f -exec chmod 664 {} +
 +
find . -type d -exec chmod 775 {} +
 +
chmod 660 wp-config.php
  
cd /var/www/fred.com/html/
+
https://www.smashingmagazine.com/2014/05/proper-wordpress-filesystem-permissions-ownerships
  
For secure permissions...
+
=== FIXES THE RECENT WORDPRESS 5 BUG OF NOT SAVING PAGES ===
  
  sudo find . -type f -exec chmod 644 {} +
+
  $HTTP["host"] =~ "domain.co.uk" {
sudo find . -type d -exec chmod 755 {} +
+
  '''url.rewrite-if-not-file''' = (
sudo chmod 640 wp-config.php
+
  # Exclude directories
 +
  "^/(wp-admin|wp-includes|wp-content|gallery2|.well-known)/(.*)" => "$0",
 +
  # Exclude root php files
 +
  "^/(.*.php)" => "$0",
 +
  # Handle permalinks and feeds
 +
  "^/(.*)$" => "/index.php/$1"
 +
  )
 +
}
  
For relaxed permissions...
+
== WordPress with NginX ==
  
sudo find . -type f -exec chmod 664 {} +
+
'''[https://www.howtoforge.com/tutorial/dockerizing-wordpress-with-nginx-and-php-fpm/ Docker WordPress with NginX and PHP-FPM]'''
sudo find . -type d -exec chmod 775 {} +
 
sudo chmod 660 wp-config.php
 
  
== HOWTO: Disable Update Check For A Single Plugin ==
+
https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-ubuntu-20-04
  
Open the main plugin file and change the version number to 9.9.9
+
https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-lemp-on-ubuntu-18-04
  
== HOWTO: Create MySQL Database ==
+
NOTES
  
# log in to mysql
+
sudo apt-get install nano
# create database
+
sudo apt-get install nginx
# set user and password and permissions
+
sudo apt-get install mysql-server
# log out of mysql
+
sudo mysql_secure_installation
 +
sudo apt-get install php-fpm php-mysql
 +
sudo apt-get install php-curl php-gd php-mbstring php-xml php-xmlrpc
 +
sudo apt-get install curl
  
mysql -u root -p
+
https://www.techrepublic.com/article/how-to-install-mcrypt-for-php-7-2/
create database wordpress;
 
GRANT SELECT, INSERT, UPDATE ON wordpress.* to 'wordpressuser'@'localhost' identified by 'mypassword';
 
quit;
 
  
== HOWTO: Generate Salt Keys ==
+
=== Tuning Performance ===
  
https://api.wordpress.org/secret-key/1.1/salt/
+
[https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-with-http-2-support-on-ubuntu-16-04 HTTP/2 with nginX]
  
== HOWTO: Complete Configuration ==
+
https://mmoapi.com/post/tuning-nginx-php-fpm-and-system-sysctl-to-increase-website-performance
  
cd /var/www/domain.com/html
+
=== Sitemaps ===
sudo rm -iv index.html
 
sudo mv -v wp-config-sample.php wp-config.php
 
sudo nano wp-config.php
 
define('DB_NAME', 'wordpressdatabase');
 
define('DB_USER', 'wordpressuser');
 
define('DB_PASSWORD', 'mYPassWOrd');
 
define('DB_HOST', 'localhost');
 
/** Authentication Unique Keys and Salts.
 
REPLACE LINES WITH YOUR LINES FROM SALT LINK ABOVE
 
  
Now load the web site in your web browser and complete installation.
+
# Rewrites for Yoast SEO XML Sitemap
 +
rewrite ^/sitemap_index.xml$ /index.php?sitemap=1 last;
 +
rewrite ^/([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
  
 +
https://yoast.com/help/xml-sitemaps-nginx/
  
 +
=== Rest API Fix ===
  
== HOWTO: Enable Updates Via SSH / SFTP ==
+
This seems to be a NginX bug with the Gutenberg Editor and is part of the Tools > Site Health error "REST API is not working correctly."
  
sudo aptitude install libssh2-php
+
Change all your lines with this...
  
Then, restart your web server software.
+
try_files $uri $uri/ /index.php;
  
Thanks - https://snowulf.com/2010/06/29/wordpress-enabling-sshsftp-updates/
+
To this...
  
== HOWTO: Update Via Command Line ==
+
try_files $uri $uri/ /index.php$is_args$args;
  
WP CLI is a command line tool for managing your WordPress installation.
+
Restart NginX and PHP FPM...
  
http://wp-cli.org
+
sudo systemctl restart php7.4-fpm.service nginx.service
 +
 
 +
https://developer.wordpress.org/rest-api/frequently-asked-questions/#query-parameters-are-not-working
  
=== Install ===
+
== Registration Page ==
  
NEW
+
/wp-login.php?action=register
  
sudo add-apt-repository ppa:tiagohillebrandt/wp-cli
+
== Backup ==
sudo apt-get update
 
sudo apt-get -s install wp-cli
 
sudo apt-get -y install wp-cli
 
sudo -u www-data wp --info
 
  
OLD
+
https://managewp.com/features/backup
  
For use with Docker containers...
+
https://websitesetup.org/wordpress-backup/
  
curl -O <nowiki>https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar</nowiki>
+
== WordPress Site Management ==
chmod +x wp-cli.phar
 
mv wp-cli.phar wp
 
chown root:root wp
 
chmod 0700 wp
 
./wp --allow-root --info
 
./wp --allow-root plugin deactivate --all
 
./wp --allow-root user list
 
  
=== Commands ===
+
https://mainwp.com/features/
  
wp --info
+
== WordPress MultiSite ==
wp core version
+
 
wp core check-update
+
https://premium.wpmudev.org/blog/ultimate-guide-multisite/
wp core update
+
 
wp core update-db
+
=== Network Activate Plugins ===
rm wp-config-sample.php
+
 
 +
On a WordPress multisite, only Super Admins can install plugins. After the installation, super admins have these options...
 +
 
 +
# Network Activate – Using this option super admins can activate a plugin across the network.
 +
# Activate – They can also activate a plugin for the main/root site.
 +
# Individual Sites – Lastly they can allow individual site administrators to activate plugins themselves.
  
=== Complete CLI Setup ===
+
When you log in to your WordPress multisite's main site, you will be able to see two different plugins screen.
  
 +
The first one is on the main admin sidebar. It is for plugins installed and available for activation on your main site.
  
#
+
The second plugins screen is located under My Sites » Network Admin » Plugins. This is where you will install new plugins and manage them for the entire network.
# using wp command line tool to make a wordpress web site
+
 
#
+
https://www.wpbeginner.com/beginners-guide/should-you-network-activate-all-plugins-on-wordpress-multisite/
+
 
# create directories and log files
+
'''Add Plugins Menu for Child Sites in WordPress Multisite'''
  sudo mkdir -p /var/www/www.domain.co.uk/{html,logs,.wp-cli/cache}
+
 
sudo touch /var/www/www.domain.co.uk/logs/{access,error}.log
+
To enable plugin’s menu for individual sites, you need to switch to Network Admin dashboard.
  sudo chmod g+w /var/www/www.domain.co.uk/logs/{access,error}.log
+
 
sudo chown -R www-data:www-data /var/www/www.domain.co.uk/
+
Switching to network admin dashboard
+
 
# change to working directory
+
On the network admin dashboard, visit Settings » Network Settings. Scroll down to the bottom of the page and you will see the checkbox to enable plugins menu.
cd /var/www/www.domain.co.uk/html/
+
 
+
=== WP CLI ===
# create environment variables
+
 
  export WP_CLI_CACHE_DIR=/var/www/www.domain.co.uk/.wp-cli/cache
+
Show list of sites...
+
 
# check wp cli working
+
  export WP_CLI_CACHE_DIR=/var/www/domain.co.uk/.wp-cli/cache; sudo -u www-data -E wp --path='/var/www/domain.co.uk/html/' site list
sudo -u www-data -E wp --info
+
 
+
Show options for a multisite site...
# download the core wordpress files
+
 
sudo -u www-data -E wp core download --locale=en_GB
+
  export WP_CLI_CACHE_DIR=/var/www/domain.co.uk/.wp-cli/cache; sudo -u www-data -E wp --path='/var/www/domain.co.uk/html/' --url='<nowiki>http://mysubdomain.domain.co.uk/</nowiki>' option get siteurl
+
 
# check the core wordpress files
+
Change option for a multisite site...
sudo -u www-data -E wp core verify-checksums
+
 
+
  export WP_CLI_CACHE_DIR=/var/www/domain.co.uk/.wp-cli/cache; sudo -u www-data -E wp --path='/var/www/domain.co.uk/html/' --url='<nowiki>http://mysubdomain.domain.co.uk/</nowiki>' option update siteurl '<nowiki>http://mysubdomain.domain.com</nowiki>'
# create a wordpress mysql database
+
 
sudo mysql -u root -p -e "CREATE DATABASE wwwdomaincouk; CREATE USER 'wwwdomaincouk' IDENTIFIED BY 'SuperPassword'; GRANT ALL ON wwwdomaincouk.* TO 'wwwdomaincouk'; FLUSH PRIVILEGES;"
+
=== Help With Making Changes ===
+
 
# create a wordpress configuration file
+
https://www.siteground.com/kb/change-domain-wordpress-multisite/
sudo -u www-data -E wp core config --dbname='wwwdomaincouk' --dbuser='wwwdomaincouk' --dbpass='SuperPassword' --dbhost='localhost' --dbprefix='wp_'
+
 
+
== Move Posts To Different Types ==
# complete the installation process
+
 
sudo -u www-data -E wp core install --url='<nowiki>http://www.domain.co.uk</nowiki>' --title='Web Site Name' --admin_user='joe.bloggs' --admin_password='MyGoodPassword' --admin_email='me@domain.co.uk'
+
* Posts to Pages
+
* Pages to Posts
# check web site working on command line and admin dashboard works
+
* Default Post Type to Custom Post Type
curl -I <nowiki>http://www.domain.co.uk</nowiki>
+
 
+
http://wordpress.org/extend/plugins/post-type-switcher/
# check for updates
 
sudo -u www-data -E wp core version
 
sudo -u www-data -E wp core update
 
sudo -u www-data -E wp core update-db
 
sudo -u www-data -E wp plugin list
 
sudo -u www-data -E wp plugin update --all
 
sudo -u www-data -E wp theme list
 
sudo -u www-data -E wp theme update --all
 
sudo -u www-data -E wp language core list --status=active
 
sudo -u www-data -E wp language core update
 
sudo -u www-data -E wp language plugin list --all --status=active
 
sudo -u www-data -E wp language plugin update --all
 
sudo -u www-data -E wp language theme list --all --status=active
 
sudo -u www-data -E wp language theme update --all
 
 
# add new user
 
sudo -u www-data -E wp user create john.doe john.doe@domain.co.uk --role=administrator --first_name=John --last_name=Doe --nickname=John --display_name=John
 
 
# list users
 
sudo -u www-data -E wp user list
 
  
=== As Another User On Server ===
+
== Custom Post Types and Categories and Taxonomies ==
  
cd /path/to/wordpress/
+
https://www.wpbeginner.com/wp-tutorials/how-to-exportimport-custom-post-types-in-wordpress/
sudo -u www-data -E wp --help
 
sudo -u www-data -E wp core --help
 
sudo -u www-data -E wp core check-update
 
sudo -u www-data -E wp core download
 
sudo -u www-data -E wp core is-installed
 
sudo -u www-data -E wp core update
 
sudo -u www-data -E wp core update-db
 
sudo -u www-data -E wp core verify-checksums
 
sudo -u www-data -E wp core version
 
sudo -u www-data -E wp plugin --help
 
sudo -u www-data -E wp plugin list
 
sudo -u www-data -E wp plugin update
 
sudo -u www-data -E wp plugin update --all
 
sudo -u www-data -E wp plugin status
 
sudo -u www-data -E wp plugin activate --all
 
sudo -u www-data -E wp plugin status
 
sudo -u www-data -E wp theme --help
 
sudo -u www-data -E wp theme list
 
sudo -u www-data -E wp theme update --all
 
sudo -u www-data -E wp theme list
 
sudo -u www-data -E wp theme delete twentysixteen
 
sudo -u www-data -E wp theme delete twentyseventeen
 
sudo -u www-data -E wp theme list
 
sudo -u www-data -E wp theme search Intentionally
 
sudo -u www-data -E wp theme install intentionally-blank
 
sudo -u www-data -E wp theme activate intentionally-blank
 
sudo -u www-data -E wp language plugin --all update
 
sudo -u www-data -E wp language theme --all update
 
sudo -u www-data -E wp language core update
 
  
=== Config List Settings ===
+
https://www.wpbeginner.com/wp-tutorials/how-to-add-categories-to-a-custom-post-type-in-wordpress/
  
wp config get
+
== Import Posts with Images ==
  
=== Config List File Location ===
+
https://wordpress.org/plugins/export-featured-images/
  
wp config path
+
https://kellenmace.com/include-featured-images-with-posts-using-wordpress-exportimport-tool/
  
=== Database Show Tables Sizes ===
+
https://wordpress.stackexchange.com/questions/257180/how-to-import-wordpress-posts-with-images-from-one-wordpress-site-to-another
  
wp db size --tables
+
== DEBUGGING ==
  
=== Database Optimise ===
+
The following code, inserted in your wp-config.php file, will log all errors, notices, and warnings to a file called debug.log in the wp-content directory.
  
wp db optimize
+
It will also hide the errors so they do not interrupt page generation.
  
=== Database Repair ===
+
// Enable WP_DEBUG mode
 +
define( 'WP_DEBUG', true );
 +
 +
// Enable Debug logging to the /wp-content/debug.log file
 +
define( 'WP_DEBUG_LOG', true );
 +
 +
// Disable display of errors and warnings
 +
define( 'WP_DEBUG_DISPLAY', false );
 +
@ini_set( 'display_errors', 0 );
 +
 +
// Use dev versions of core JS and CSS files (only needed if you are modifying these core files)
 +
define( 'SCRIPT_DEBUG', true );
  
wp db repair
+
'''NOTE: You must insert this BEFORE /* That's all, stop editing! Happy blogging. */ in the wp-config.php file.'''
  
=== Database Export ===
+
== Google Maps ==
  
wp db export
+
https://www.embedgooglemap.net/
  
=== Database Export With Filename ===
+
== HOWTO: Create Folders Within Media Library ==
  
wp db export ./filename.sql
+
https://maxgalleria.com/add-organize-media-library-folders/
  
=== Database Search ===
+
https://wordpress.org/plugins/media-library-plus/
  
wp db query "SELECT * FROM wp_options"
+
== HOWTO: Download Older Versions of WordPress Plugins ==
  
=== Plugin Install ===
+
https://kinsta.com/knowledgebase/download-older-versions-of-wordpress-plugins/
  
Install...
+
== HOWTO: Increase PHP Memory Limit (UpdraftPlus Error) ==
  
wp plugin install wordpress-seo
+
If you see this error when you use the wp cli ...
  
Install and activate...
+
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate xxxxx bytes)
  
wp plugin install wordpress-seo --activate
+
... then you can fix it by adding this to the wp-config.php file just before the "<nowiki>/* That's all, stop editing! Happy publishing. */</nowiki>" line:-
  
Install and activate a particular version...
+
define('WP_MEMORY_LIMIT', '256M');
  
wp plugin install wordpress-seo --version=4.8 --activate
+
https://updraftplus.com/faqs/deal-fatal-error-allowed-memory-size-errors/
  
Install and activate multiple plugins...
+
== HOWTO: Disable wp-cron.php WP_CRON ==
  
wp plugin install advanced-custom-fields jetpack --activate
+
WordPress uses a file called wp-cron.php as a virtual cron job, or scheduled task in order to automate things like publishing scheduled posts, checking for plugin or theme updates, sending email notifications and more.
  
Install and activate from your own location...
+
By default WordPress is set up to call wp-cron.php every time someone visits your WordPress website when a scheduled task is present, to basically ask "is it time to do anything yet?".
  
wp plugin install <nowiki>https://www.domain.com/path/to/my/myplugin.zip</nowiki> --activate
+
On low traffic sites this is perfectly fine, but when visitors roll in, checking multiple times for scheduled tasks can be very inefficient and lead to resource usage problems for your server, plus make your website load slower.
  
=== Plugin Deactivate ===
+
To fix this, change the following setting in your '''wp-config.php''' file...
  
Deactivate...
+
define('DISABLE_WP_CRON', true);
  
wp plugin deactivate wordpress-seo
+
Then, create a cron job to call the script...
  
Deactivate all plugins (good for debugging a problem!)...  
+
crontab -e
 +
@hourly cd /var/www/website.co.uk/html/ && sudo -u www-data php wp-cron.php
  
wp plugin deactivate --all
+
or
  
=== Plugin Update ===
+
@hourly curl --silent https://www.website.co.uk/wp-cron.php?doing_wp_cron
  
Update...
+
Thanks - https://www.inmotionhosting.com/support/website/wordpress/disabling-the-wp-cronphp-in-wordpress
  
wp plugin update wordpress-seo
+
== HOWTO: Disable WordPress User Account ==
  
Update all plugins...
+
* Method 1 - change the user's role to 'No Role For This Site'
 +
* Method 2 - install the [https://wordpress.org/plugins/disable-users/ Disable Users Plugin] and disable that user.
  
wp plugin update --all
+
Thanks - https://9seeds.com/how-to-disable-wordpress-user-accounts/
  
=== Site Blank ===
+
== Hide Page Title On Home Page Only ==
  
  wp site empty
+
  body.home header.entry-header {
 +
  display: none;
 +
}
  
=== Site Blank and Delete Media Uploads ===
+
== HOWTO: Hide Page Title Per Basis ==
  
wp site empty --uploads
+
'''style.css'''
  
=== Theme Child Create ===
+
.page-id-1826 .entry-title {display: none;}
  
wp scaffold child-theme NEW-CHILD-SLUG --parent_theme=SLUG --theme_name=TITLE
+
Thanks - https://premium.wpmudev.org/blog/wordpress-hide-page-title-or-post-title-on-a-case-by-case-basis/
  
=== Help ===
+
== HOWTO: Download Latest Version ==
  
https://www.codeinwp.com/blog/wp-cli/
+
wget -O wordpress-latest.tar.gz <nowiki>http://wordpress.org/latest.tar.gz</nowiki>
  
=== Update Admin Email Address ===
+
== HOWTO: Update Admin User Password Command Line ==
  
  wp option update admin_email 'me@domain.co.uk'
+
  mysql -u root -p wordpress_database -e "UPDATE wp_users SET user_pass=MD5('MyNewPassword') WHERE ID='1';"
wp option update new_admin_email 'me@domain.co.uk'
 
  
=== User List ===
+
== HOWTO: Extract WordPress Without First Directory ==
  
  sudo -u www-data wp user list
+
  sudo tar --strip-components=1 -xzvf latest.tar.gz -C /path/to/directory/
  
=== User Reset Password ===
+
e.g.
  
1. Move into the /wordpress directory and type
+
sudo tar --strip-components=1 -xzvf latest.tar.gz -C /var/www/domain.com/html/
  
sudo -u www-data wp user list
+
== HOWTO: Correct Ownership And Permissions Of BITNAMI Wordpress Files ==
  
to see all users. Find the ID of the user you'd like to update.
+
sudo chown -R daemon:daemon /opt/bitnami/apps/wordpress/htdocs
 +
sudo find /opt/bitnami/apps/wordpress/htdocs -type d -exec chmod 755 {} \;
 +
sudo find /opt/bitnami/apps/wordpress/htdocs -type f -exec chmod 644 {} \;
 +
sudo /opt/bitnami/ctlscript.sh restart apache
 +
sudo /opt/bitnami/ctlscript.sh restart php-fpm
  
2. Then, update the user
+
https://morganhvidt.com/fix-permissions-wordpress-bitnami-gcp/
  
sudo -u www-data wp user update 1 --user_pass=$UP3RstrongP4$$w0rd
+
== HOWTO: Install Different PHP Modules on BITNAMI WordPress ==
  
replacing "1" with the id of the user you want to update.
+
Bitnami stacks already include a number of PHP modules, which are installed but not active. Before installing a new module, check that it is not already included. If it exists, simply enable it in the PHP configuration file.
  
=== Check A Post For Type ===
+
=== Imagick ===
  
sudo -u www-data wp post get 230
+
The Imagick module is installed in Bitnami stacks, but is not enabled by default. To enable it, follow these steps:
  
=== Show WordPress URL ===
+
Uncomment or add the following line to the /opt/bitnami/php/etc/php.ini file:
  
  wp option get home
+
  ...
  wp option get siteurl
+
  extension=imagick.so
 +
...
  
=== Change WordPress URL ===
+
Restart the Apache server and/or the PHP-FPM service (if available):
  
  wp option update home '<nowiki>http://example.com</nowiki>'
+
  sudo /opt/bitnami/ctlscript.sh restart apache
  wp option update siteurl '<nowiki>http://example.com</nowiki>'
+
  sudo /opt/bitnami/ctlscript.sh restart php-fpm
  
=== Search and Replace and View Changes ===
+
[https://docs.bitnami.com/aws/apps/wordpress/configuration/install-modules-php/ Thanks]
  
  sudo -u www-data wp search-replace 'Lorem ' 'Lorum ' --dry-run --report-changed-only --log
+
== HOWTO: Correct Ownership And Permissions Of Wordpress Files ==
  
=== Search and Replace WordPress Database Change URL ===
+
You need to make the user the FTP login and the group the user Apache or Lighttpd runs as...
  
  sudo -u wpusername wp search-replace '<nowiki>http://test.domain.co.uk</nowiki>' '<nowiki>http://www.domain.co.uk</nowiki>' --dry-run
+
  sudo chown -R fred:www-data /var/www/fred.com/html/
sudo -u wpusername wp search-replace '<nowiki>http://test.domain.co.uk</nowiki>' '<nowiki>http://www.domain.co.uk</nowiki>'
 
  
or for auto SSL sites...
+
Change to the correct directory...
  
  sudo -u wpusername wp search-replace '<nowiki>http://test.domain.co.uk</nowiki>' '<nowiki>https://www.domain.co.uk</nowiki>' --dry-run
+
  cd /var/www/fred.com/html/
sudo -u wpusername wp search-replace '<nowiki>http://test.domain.co.uk</nowiki>' '<nowiki>https://www.domain.co.uk</nowiki>'
 
  
=== Export All Users ===
+
For secure permissions...
  
This will export all users to a CSV...
+
sudo find . -type f -exec chmod 644 {} +
 +
sudo find . -type d -exec chmod 755 {} +
 +
sudo chmod 640 wp-config.php
  
sudo -u daemon -E wp --path=/opt/bitnami/apps/wordpress/htdocs/2 user list --format=csv >user_list.csv
+
For relaxed permissions...
  
=== Block A User ===
+
sudo find . -type f -exec chmod 664 {} +
 +
sudo find . -type d -exec chmod 775 {} +
 +
sudo chmod 660 wp-config.php
  
# change their password
+
== HOWTO: Disable Update Check For A Single Plugin ==
# change their role
 
# change their email address
 
  
export WP_CLI_CACHE_DIR=/var/www/www.domain.co.uk/.wp-cli/cache/
+
Open the main plugin file and change the version number to 9.9.9
sudo -u www-data wp --path=/var/www/www.domain.co.uk/html/ user list
 
sudo -u www-data wp --path=/var/www/www.domain.co.uk/html/ user update 2 --user_pass=iphoh3Qu --skip-email
 
sudo -u www-data wp --path=/var/www/www.domain.co.uk/html/ user update 2 --role= --skip-email
 
sudo -u www-data wp --path=/var/www/www.domain.co.uk/html/ user update 2 --user_email=different.email@domain.co.uk --skip-email
 
sudo -u www-data wp --path=/var/www/www.domain.co.uk/html/ user list
 
  
=== Delete All Subscribers ===
+
== HOWTO: Create MySQL Database ==
  
For this trick, you have to combine 2 commands in to 1... generate the list of users + feed that result to the delete command...
+
# log in to mysql
 +
# create database
 +
# set user and password and permissions
 +
# log out of mysql
  
  $ wp user delete $(wp user list --role=subscriber --field=ID) --reassign=2
+
  mysql -u root -p
 +
create database wordpress;
 +
GRANT SELECT, INSERT, UPDATE ON wordpress.* to 'wordpressuser'@'localhost' identified by 'mypassword';
 +
quit;
  
'''Do the [http://wiki.indie-it.com/wiki/WordPress#Export_All_Users Export All Users] first!'''
+
== HOWTO: Generate Salt Keys ==
  
This is an example from a Bitnami WordPress install, using the user 'daemon' and the full path for completeness...
+
https://api.wordpress.org/secret-key/1.1/salt/
  
sudo -u daemon -E wp --path=/opt/bitnami/apps/wordpress/htdocs/2 user delete $(sudo -u daemon -E wp --path=/opt/bitnami/apps/wordpress/htdocs/2 user list --role=subscriber --field=ID) --reassign=23
+
== HOWTO: Complete Configuration ==
  
=== Perform Commands Remotely ===
+
cd /var/www/domain.com/html
 +
sudo rm -iv index.html
 +
sudo mv -v wp-config-sample.php wp-config.php
 +
sudo nano wp-config.php
 +
define('DB_NAME', 'wordpressdatabase');
 +
define('DB_USER', 'wordpressuser');
 +
define('DB_PASSWORD', 'mYPassWOrd');
 +
define('DB_HOST', 'localhost');
 +
/** Authentication Unique Keys and Salts.
 +
REPLACE LINES WITH YOUR LINES FROM SALT LINK ABOVE
  
WP-CLI accepts an <nowiki>--ssh=[<scheme>][<user>@]<host>[:<port>][<path>]</nowiki> global parameter for running a command against a remote WordPress install.
+
Now load the web site in your web browser and complete installation.
  
First, install wp-cli on your computer...
 
  
sudo add-apt-repository ppa:tiagohillebrandt/wp-cli
 
sudo apt-get -y install wp-cli
 
sudo -u www-data wp --info
 
  
Then, use a host entry in your ~/.ssh/config file for your server, then you can run this...
+
== HOWTO: Enable Updates Via SSH / SFTP ==
  
  wp --ssh=host --user=jbloggs --path='/var/www/domain.com/html' core version
+
  sudo aptitude install libssh2-php
  
https://make.wordpress.org/cli/handbook/guides/running-commands-remotely/
+
Then, restart your web server software.
  
=== Migrate Copy Your Site ===
+
Thanks - https://snowulf.com/2010/06/29/wordpress-enabling-sshsftp-updates/
  
https://rocketgeek.com/basics/using-wp-cli-to-migrate-copy-your-site/
+
== HOWTO: Update Via Command Line ==
  
=== Convert to Multisite ===
+
WP CLI is a command line tool for managing your WordPress installation.
  
wp core multisite-convert --subdomains
+
http://wp-cli.org
wp site list
 
  
https://developer.wordpress.org/cli/commands/core/multisite-convert/
+
=== Install ===
  
https://developer.wordpress.org/cli/commands/site/
+
NEW
  
=== BackWPup ===
+
sudo add-apt-repository ppa:tiagohillebrandt/wp-cli
 +
sudo apt-get update
 +
sudo apt-get -s install wp-cli
 +
sudo apt-get -y install wp-cli
 +
sudo -u www-data wp --info
  
wp backwpup start <job-id>
+
OLD
  
https://backwpup.com/docs/starting-backup-job-immediately-or-scheduled/
+
For use with Docker containers...
  
== HOWTO: CREATE: Child Themes ==
+
curl -O <nowiki>https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar</nowiki>
 +
chmod +x wp-cli.phar
 +
mv wp-cli.phar wp
 +
chown root:root wp
 +
chmod 0700 wp
 +
./wp --allow-root --info
 +
./wp --allow-root plugin deactivate --all
 +
./wp --allow-root user list
  
*FTP in to site
+
=== IONOS Tweaks ===
*Navigate to <span style="background:#c0c0c0">wp-content</span> '''|''' <span style="background:#c0c0c0"> themes</span>
 
*Create a new folder for the child theme, for example <span style="background:#c0c0c0">twentyfifteen-child</span> (where twentyfifteen is the name of your parent theme)
 
*Create a text file named <span style="background:#c0c0c0">style.css</span>
 
*Copy and paste the text from <span style="background:#c0c0c0">Example 1</span> below in to the <span style="background:#c0c0c0">style.css</span> file.
 
  
Example 1:
+
Out of the box, the IONOS Linux hosting seems to use PHP 7.3 for wp-cli ...
  
  /*
+
  wp cli info
Theme Name: Example
 
Theme URI: <nowiki>http://example.co.uk</nowiki>
 
Description: Custom child theme
 
Author: Why me of course
 
Author URI: <nowiki>http://anotherexample.com</nowiki>
 
Template: theme-child
 
Version: 0.1
 
*/
 
 
@import url("../theme/style.css");
 
  
*Next alter the text so it matches the details of the website the parent theme.
+
To fix this, select your PHP version in the admin panel - e.g. 7.4
  
Example 2:
+
Log in to your hosting server using SSH, then check to make sure this test works ...
  
  /*
+
  /usr/bin/php7.4-cli /usr/share/php/wp-cli/wp-cli-2.6.0.phar cli info
Theme Name: twentyeleven-child
 
Theme URI: <nowiki>http://mywebsite.co.uk</nowiki>
 
Description: Custom child theme
 
Author: Fred Dibnah
 
Author URI: <nowiki>http://dibnah-inc.com</nowiki>
 
Template: twentyeleven
 
Version: 0.1
 
*/
 
 
@import url("../twentyeleven/style.css");
 
  
*FTP <span style="background:#c0c0c0">style.css</span> to <span style="background:#c0c0c0">wp-content</span> '''|''' <span style="background:#c0c0c0">themes</span> '''|''' <span style="background:#c0c0c0">twentyfifteen-child</span>
+
Then, assign a terminal shall alias to 'wp' for the second test and run 'wp' ...
*In the WordPress control panel navigate to <span style="background:#c0c0c0">Appearance</span> '''|''' <span style="background:#c0c0c0">Themes</span>
 
  
== HOWTO: REMOVE: Comment Box From An Existing Page ==
+
alias wp='/usr/bin/php7.4-cli /usr/share/php/wp-cli/wp-cli-2.6.0.phar'
 +
wp cli info
  
*All Pages
+
Then, create a few files to automatically load the alias and fix it ...
*Select the 'Quick Edit' option
 
*Un-tick 'Allow Comments'
 
  
== HOWTO: ALTER: Site URL ==
+
nano ~/.bash_profile
 +
alias ll='ls -lah'
 +
alias wp='/usr/bin/php7.4-cli /usr/share/php/wp-cli/wp-cli-2.6.0.phar'
  
There are various methods to change the Site URL manually. Any of these methods will work and perform much the same function.
+
nano ~/.bashrc
 +
source ~/.bash_profile
  
=== 1. Edit wp-config.php ===
+
Log out, then back in and type ...
  
It is possible to set the site URL manually in the wp-config.php file.
+
wp cli info
  
Add these two lines to your '''wp-config.php''', where "example.com" is the correct location of your site.
+
... and it should now show the later version of PHP being used.
  
define('WP_HOME','<nowiki>http://example.com</nowiki>');
+
=== Commands ===
define('WP_SITEURL','<nowiki>http://example.com</nowiki>');
 
  
=== 2. MySQL ===
+
wp --info
 +
wp core version
 +
wp core check-update
 +
wp core update
 +
wp core update-db
 +
wp core verify-checksums
 +
wp theme update --all
 +
wp plugin update --all
 +
wp language core update
 +
wp language theme --all update
 +
wp language plugin --all update
  
Edit '''home''' and '''siteurl''' from the ''wp_options'' table using [https://www.phpmyadmin.net/ PHPMyAdmin] or similar.
+
=== Complete CLI Setup ===
  
=== 3. wp Command Line ===
 
  
'''A.''' You can use the official [https://developer.wordpress.org/cli/commands/ WP command line tool] to alter the 'home', 'siteurl' options.
+
#
 
+
# using wp command line tool to make a wordpress web site
  cd /path/to/wordpress/files
+
#
  sudo -u user wp option get home
+
  sudo -u user wp option get siteurl
+
  # create directories and log files
  sudo -u user wp option update home <nowiki>'http://www.domain.co.uk'</nowiki>
+
  sudo mkdir -p /var/www/www.domain.co.uk/{html,logs,.wp-cli/cache}
  sudo -u user wp option update siteurl <nowiki>'http://www.domain.co.uk'</nowiki>
+
  sudo touch /var/www/www.domain.co.uk/logs/{access,error}.log
 
+
  sudo chmod g+w /var/www/www.domain.co.uk/logs/{access,error}.log
https://developer.wordpress.org/cli/commands/option/
+
  sudo chown -R www-data:www-data /var/www/www.domain.co.uk/
 
+
'''B.''' You can also use the command line to alter every part of the MySQL Database.
+
# change to working directory
 
+
cd /var/www/www.domain.co.uk/html/
  cd /path/to/wordpress/files
+
  sudo -u user wp search-replace <nowiki>'http://test.domain.co.uk'</nowiki> <nowiki>'http://www.domain.co.uk'</nowiki> --dry-run
+
# create environment variables
sudo -u user wp search-replace <nowiki>'http://test.domain.co.uk'</nowiki> <nowiki>'http://www.domain.co.uk'</nowiki>
+
export WP_CLI_CACHE_DIR=/var/www/www.domain.co.uk/.wp-cli/cache
 
+
https://developer.wordpress.org/cli/commands/search-replace/
+
# check wp cli working
 
+
sudo -u www-data -E wp --info
== HOWTO: htaccess Extra Security Tweaks ==
+
 
+
# download the core wordpress files
  <IfModule mod_rewrite.c>
+
sudo -u www-data -E wp core download --locale=en_GB
  RewriteEngine On
+
  RewriteBase /
+
# check the core wordpress files
  RewriteRule ^index\.php$ - [L]
+
sudo -u www-data -E wp core verify-checksums
  RewriteCond %{REQUEST_FILENAME} !-f
+
  RewriteCond %{REQUEST_FILENAME} !-d
+
# create a wordpress mysql database
  RewriteRule . /index.php [L]
+
sudo mysql -u root -p -e "CREATE DATABASE wwwdomaincouk; CREATE USER 'wwwdomaincouk' IDENTIFIED BY 'SuperPassword'; GRANT ALL ON wwwdomaincouk.* TO 'wwwdomaincouk'; FLUSH PRIVILEGES;"
  # extra security tweaks
+
  RewriteRule ^wp-admin/includes/ - [F,L]
+
  # create a wordpress configuration file
  RewriteRule !^wp-includes/ - [S=3]
+
  sudo -u www-data -E wp core config --dbname='wwwdomaincouk' --dbuser='wwwdomaincouk' --dbpass='SuperPassword' --dbhost='localhost' --dbprefix='wp_'
  RewriteRule ^wp-includes/[^/]+\.php$ - [F,L]
+
  RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L]
+
# complete the installation process
RewriteRule ^wp-includes/theme-compat/ - [F,L]
+
sudo -u www-data -E wp core install --url='<nowiki>http://www.domain.co.uk</nowiki>' --title='Web Site Name' --admin_user='joe.bloggs' --admin_password='MyGoodPassword' --admin_email='me@domain.co.uk'
  </IfModule>
+
 
+
# check web site working on command line and admin dashboard works
http://wordpress.org/download/
+
curl -I <nowiki>http://www.domain.co.uk</nowiki>
 +
 +
# check for updates
 +
sudo -u www-data -E wp core version
 +
sudo -u www-data -E wp core update
 +
  sudo -u www-data -E wp core update-db
 +
  sudo -u www-data -E wp plugin list
 +
  sudo -u www-data -E wp plugin update --all
 +
  sudo -u www-data -E wp theme list
 +
  sudo -u www-data -E wp theme update --all
 +
  sudo -u www-data -E wp language core list --status=active
 +
  sudo -u www-data -E wp language core update
 +
  sudo -u www-data -E wp language plugin list --all --status=active
 +
  sudo -u www-data -E wp language plugin update --all
 +
  sudo -u www-data -E wp language theme list --all --status=active
 +
  sudo -u www-data -E wp language theme update --all
 +
 +
# add new user
 +
  sudo -u www-data -E wp user create john.doe john.doe@domain.co.uk --role=administrator --first_name=John --last_name=Doe --nickname=John --display_name=John
 +
   
 +
# list users
 +
sudo -u www-data -E wp user list
  
== HOWTO: Disable All Plugins Via PHPMyAdmin Or MySQL ==
+
=== As Another User On Server ===
  
  mysql> update wp_options set option_value = "a:0:{}" where option_name = 'active_plugins';
+
  cd /path/to/wordpress/
 
+
sudo -u www-data -E wp --help
Thanks to - http://www.webhostinghero.com/manually-disable-wordpress-plugins/
+
sudo -u www-data -E wp core --help
 +
sudo -u www-data -E wp core check-update
 +
sudo -u www-data -E wp core download
 +
sudo -u www-data -E wp core is-installed
 +
sudo -u www-data -E wp core update
 +
sudo -u www-data -E wp core update-db
 +
sudo -u www-data -E wp core verify-checksums
 +
sudo -u www-data -E wp core version
 +
sudo -u www-data -E wp plugin --help
 +
sudo -u www-data -E wp plugin list
 +
sudo -u www-data -E wp plugin update
 +
sudo -u www-data -E wp plugin update --all
 +
sudo -u www-data -E wp plugin status
 +
sudo -u www-data -E wp plugin activate --all
 +
sudo -u www-data -E wp plugin status
 +
sudo -u www-data -E wp theme --help
 +
sudo -u www-data -E wp theme list
 +
sudo -u www-data -E wp theme update --all
 +
sudo -u www-data -E wp theme list
 +
sudo -u www-data -E wp theme delete twentysixteen
 +
sudo -u www-data -E wp theme delete twentyseventeen
 +
sudo -u www-data -E wp theme list
 +
sudo -u www-data -E wp theme search Intentionally
 +
sudo -u www-data -E wp theme install intentionally-blank
 +
sudo -u www-data -E wp theme activate intentionally-blank
 +
sudo -u www-data -E wp language plugin --all update
 +
sudo -u www-data -E wp language theme --all update
 +
sudo -u www-data -E wp language core update
  
== HOWTO: WordPress Security ==
+
=== Config List Settings ===
  
=== Plugins ===
+
wp config get
  
# [https://wordpress.org/plugins/wordfence/ WordFence]
+
=== Config List File Location ===
# [https://wordpress.org/plugins/no-captcha-recaptcha/ reCAPTCHA]
 
# [https://wordpress.org/plugins/health-check/ Health Check]
 
# [https://hidemywpghost.com/hide-my-wp/ Hide My WP WordPress] and [https://hidemywpghost.com/article/how-to-set-hide-my-wp-for-bitnami-servers/ How to set up Hide my WP for Bitnami Servers]
 
  
=== Password Protect Admin Folder Dashboard ===
+
wp config path
  
https://www.wpbeginner.com/wp-tutorials/how-to-password-protect-your-wordpress-admin-wp-admin-directory/
+
=== Database Show Tables Sizes ===
  
=== Tutorials ===
+
wp db size --tables
  
[https://www.codeinwp.com/blog/secure-your-wordpress-website/ Secure Your WordPress Website]
+
=== Database Optimise ===
  
[https://themeisle.com/blog/secure-wordpress-theme/ Secure WordPress Theme]
+
wp db optimize
  
[https://www.wpbeginner.com/wordpress-security/ The Ultimate WordPress Security Guide]
+
=== Database Repair ===
  
=== Security Updates Mailing List ===
+
wp db repair
  
http://www.wordfence.com/subscribe-to-the-wordfence-email-list/
+
=== Database Export ===
  
== HOWTO: WordPress Core: Add Page Last Modified Date ==
+
wp db export
  
Add this code to your footer.php file...
+
=== Database Export With Filename ===
  
  <nowiki>Last modified: <?php the_modified_date(); ?></nowiki>
+
  wp db export ./filename.sql
  
http://codex.wordpress.org/Template_Tags/the_modified_date
+
=== Database Search ===
  
== HOWTO: WP-Members: Remove Powered By Link In Footer ==
+
wp db query "SELECT * FROM wp_options"
  
Edit the file...
+
=== Clear Cache ===
  
  wp-content/plugins/wp-members/wp-members-dialogs.php
+
  wp cache flush
  
Search for 'powered by' and comment out both lines.
+
=== Plugin Install ===
  
== HOWTO: Deactivate all plugins when unable to access the administrative menus? ==
+
Install...
  
* Via FTP or your host's file manager, navigate to the wp-contents folder (directory)
+
wp plugin install wordpress-seo
* Via FTP or your host's file manager, rename the folder "plugins" to "plugins.hold"
 
* Login to your WordPress administration menus (/wp-admin)
 
* Via FTP or your host's file manager, rename "plugins.hold" back to "plugins"
 
  
http://codex.wordpress.org/FAQ_Troubleshooting
+
Install and activate...
  
== DukaPress Shop Plugin ==
+
wp plugin install wordpress-seo --activate
  
TO BE DONE.
+
Install and activate a particular version...
  
== HOWTO: SET: The Home Page As A Static Page Instead Of Post ==
+
wp plugin install wordpress-seo --version=4.8 --activate
  
* Create a new page, it does not have to be called home.
+
Install and activate multiple plugins...
* Settings --> Reading --> Front page displays --> change from 'Your latest posts' to 'A static page (select below) and use the drop down menu to set the page required.
 
* Click 'Save Changes'.
 
* Optional: If you still want a 'Posts page' posts that option is also allowed for.
 
  
== HOWTO: SET: Menus As A Non-Clickable Top Level Item ==
+
wp plugin install advanced-custom-fields jetpack --activate
  
This method only applies if you are using the default menu provided in WordPress.
+
Install and activate from your own location...
  
First off do not create a page for the non-clickable as there is no need.
+
wp plugin install <nowiki>https://www.domain.com/path/to/my/myplugin.zip</nowiki> --activate
  
* WP Menu --> Appearance --> Menus
+
=== Plugin Deactivate ===
* Links widget (under Pages in the left hand widget)
 
* In the URL box change the contents 'http://' to '#' (without the quotes)
 
* Add a label
 
* Click the 'Add to Menu' button
 
* Click the 'Save Menu' button
 
  
== WorldPay ==
+
Deactivate...
  
TO BE DONE.
+
wp plugin deactivate wordpress-seo
  
'''Test Credit Card Numbers''' - http://www.worldpay.com/support/kb/bg/testandgolive/tgl5103.html
+
Deactivate all plugins (good for debugging a problem!)...  
  
== HOWTO: Permalinks (Page URL) - Alter ==
+
wp plugin deactivate --all
  
Go to:
+
=== Plugin Update ===
  
Control Panel --> Settings --> Permalinks
+
Update...
  
Select 'Post name'
+
wp plugin update wordpress-seo
  
Finally click the 'Save Changes' button.
+
Update all plugins...
  
Or the more complicated method:
+
wp plugin update --all
  
Add this to your .htaccess file...
+
=== Site Blank ===
  
  # BEGIN WordPress
+
  wp site empty
<IfModule mod_rewrite.c>
 
RewriteEngine On
 
RewriteBase /
 
RewriteRule ^index\.php$ - [L]
 
RewriteCond %{REQUEST_FILENAME} !-f
 
RewriteCond %{REQUEST_FILENAME} !-d
 
RewriteRule . /index.php [L]
 
</IfModule>
 
# END WordPress
 
  
== Mobile Skin ==
+
=== Site Blank and Delete Media Uploads ===
  
http://wordpress.org/extend/plugins/wptouch/
+
wp site empty --uploads
 +
wp site empty --uploads --yes
  
== HOWTO: REMOVE: 'Home' Button ==
+
=== Theme Child Create ===
  
The code you need to modify is located in the TwentyTen Theme's functions.php file.
+
wp scaffold child-theme NEW-CHILD-SLUG --parent_theme=SLUG --theme_name=TITLE
  
$args['show_home'] = false;
+
=== Help ===
  
== PLUGIN: Yoast SEO ==
+
https://www.codeinwp.com/blog/wp-cli/
  
=== Fix Incorrect URL On Breadcrumbs Links After Site Move ===
+
=== Update Admin Email Address ===
  
# Install the Yoast Test Helper plugin, found here https://wordpress.org/plugins/yoast-test-helper/
+
wp option update admin_email 'me@domain.co.uk'
# Go to <code>Tools → Yoast Test</code>
+
wp option update new_admin_email 'me@domain.co.uk'
# Click the '''Reset Indexables tables and Migrations''' button
 
# Go to <code>SEO → Tools</code>
 
# Click the '''Start SEO Optimisation''' button and let it complete
 
  
https://wordpress.org/support/topic/after-the-change-of-domain-breadcrumbs-link-partly-still-old-url/
+
=== User List ===
  
=== How To Hide Breadcrumbs On Home Page ===
+
sudo -u www-data wp user list
  
body.home #breadcrumbs {
+
=== User Create ===
  display: none;
 
}
 
  
== PLUGIN: Coming Soon and Maintenance Mode ==
+
wp user create <user-login> <user-email> [--role=<role>] [--user_pass=<password>] [--user_registered=<yyyy-mm-dd-hh-ii-ss>] [--display_name=<name>] [--user_nicename=<nice_name>]
 +
[--user_url=<url>] [--nickname=<nickname>] [--first_name=<first_name>] [--last_name=<last_name>] [--description=<description>] [--rich_editing=<rich_editing>] [--send-email] [--porcelain]
  
https://en-gb.wordpress.org/plugins/coming-soon/
+
sudo -u www-data wp user create joe.bloggs joe@bloggs.com --role=editor --display_name=Joe Bloggs --first_name=Joe --last_name=Bloggs
  
== PLUGIN: All-In-One WP Migration ==
+
=== User Reset Password ===
  
[https://ryankozak.com/all-in-one-migration-sizelimit/ Size Limit Fix]
+
1. Move into the /wordpress directory and type
  
  /wp-content/plugins/all-in-one-wp-migration/constants.php
+
  sudo -u www-data wp user list
  
// =================
+
to see all users. Find the ID of the user you'd like to update.
// = Max File Size =
 
// =================
 
define( 'AI1WM_MAX_FILE_SIZE', 536870912 * 8 );
 
  
== PLUGINS: Caching ==
+
2. Then, update the user
  
https://www.elegantthemes.com/blog/resources/the-best-wordpress-cache-plugins-and-how-to-use-them
+
sudo -u www-data wp user update 1 --user_pass=changeme --skip-email
  
== HOWTO: FIX: ==
+
replacing "1" with the id of the user you want to update.
  
=== Error: Minified React error #31 ===
+
=== Check A Post For Type ===
  
This seems to be a NginX bug with the Gutenberg Editor and is part of the Tools > Site Health error "REST API is not working correctly."
+
sudo -u www-data wp post get 230
  
Change all your lines with this...
+
=== Show WordPress URL ===
 +
 
 +
wp option get home
 +
wp option get siteurl
 +
 
 +
=== Change WordPress URL ===
  
  try_files $uri $uri/ /index.php;
+
  wp option update home '<nowiki>http://example.com</nowiki>'
 +
wp option update siteurl '<nowiki>http://example.com</nowiki>'
  
To this...
+
=== Search and Replace and View Changes ===
  
  try_files $uri $uri/ /index.php$is_args$args;
+
  sudo -u www-data wp search-replace 'Lorem ' 'Lorum ' --dry-run --report-changed-only --log
  
Restart NginX and PHP FPM...
+
=== Search and Replace WordPress Database Change URL ===
  
  sudo systemctl restart php7.4-fpm.service nginx.service
+
  sudo -u wpusername wp search-replace '<nowiki>http://test.domain.co.uk</nowiki>' '<nowiki>http://www.domain.co.uk</nowiki>' --dry-run
 +
sudo -u wpusername wp search-replace '<nowiki>http://test.domain.co.uk</nowiki>' '<nowiki>http://www.domain.co.uk</nowiki>'
  
https://developer.wordpress.org/rest-api/frequently-asked-questions/#query-parameters-are-not-working
+
or for auto SSL sites...
  
=== Error: Sorry, you are not allowed to edit posts in this post type ===
+
sudo -u wpusername wp search-replace '<nowiki>http://test.domain.co.uk</nowiki>' '<nowiki>https://www.domain.co.uk</nowiki>' --dry-run
 +
sudo -u wpusername wp search-replace '<nowiki>http://test.domain.co.uk</nowiki>' '<nowiki>https://www.domain.co.uk</nowiki>'
  
This is probably because it is a post type of revision...
+
=== Export All Users ===
  
sudo -u www-data wp post get 449
+
This will export all users to a CSV...
...
 
post_name            | 230-revision-v1
 
post_type            | revision
 
  
=== Error: changeset_post_save_failure ===
+
sudo -u daemon -E wp --path=/opt/bitnami/apps/wordpress/htdocs/2 user list --format=csv >user_list.csv
 
+
 
This is caused by a faulty PHP file in the WordPress installation and a possible MySQL database corruption.
+
=== Block A User ===
 
+
 
Use wp command line to backup the database, then clear the database, then force upgrade the WP install.
+
# change their password
 
+
# change their role
  sudo -i
+
# change their email address
  sudo -u www-data -E wp db export wp_db_export_file.sql
+
 
  chown www-data:www-data wp_db_export_file.sql
+
export WP_CLI_CACHE_DIR=/var/www/www.domain.co.uk/.wp-cli/cache/
  cp -av wp_db_export_file.sql ~/
+
sudo -u www-data wp --path=/var/www/www.domain.co.uk/html/ user list
  cp -av wp-config.php ~/
+
sudo -u www-data wp --path=/var/www/www.domain.co.uk/html/ user update 2 --user_pass=iphoh3Qu --skip-email
  sudo -u www-data -E wp db reset --yes
+
sudo -u www-data wp --path=/var/www/www.domain.co.uk/html/ user update 2 --role= --skip-email
  service mysql restart
+
sudo -u www-data wp --path=/var/www/www.domain.co.uk/html/ user update 2 --user_email=different.email@domain.co.uk --skip-email
  sudo -u www-data -E wp db import wp_db_export_file.sql
+
sudo -u www-data wp --path=/var/www/www.domain.co.uk/html/ user list
  sudo -u www-data -E wp db check
+
 
  sudo -u www-data -E wp db tables
+
=== Delete All Subscribers ===
  sudo -u www-data -E wp core update --force --locale=en_GB
+
 
  sudo -u www-data -E wp core update-db
+
For this trick, you have to combine 2 commands in to 1... generate the list of users + feed that result to the delete command...
  sudo -u www-data -E wp core verify-checksums --locale=en_GB
+
 
 +
$ wp user delete $(wp user list --role=subscriber --field=ID) --reassign=2
 +
 
 +
'''Do the [http://wiki.indie-it.com/wiki/WordPress#Export_All_Users Export All Users] first!'''
 +
 
 +
This is an example from a Bitnami WordPress install, using the user 'daemon' and the full path for completeness...
 +
 
 +
sudo -u daemon -E wp --path=/opt/bitnami/apps/wordpress/htdocs/2 user delete $(sudo -u daemon -E wp --path=/opt/bitnami/apps/wordpress/htdocs/2 user list --role=subscriber --field=ID) --reassign=23
 +
 
 +
=== Delete Comments ===
 +
 
 +
wp comment delete $(wp comment list --status=spam --format=ids) --force
 +
 
 +
or
 +
 
 +
wp comment delete $(wp comment list --format=ids) --force
 +
 
 +
=== Perform Commands Remotely ===
 +
 
 +
WP-CLI accepts an <nowiki>--ssh=[<scheme>][<user>@]<host>[:<port>][<path>]</nowiki> global parameter for running a command against a remote WordPress install.
 +
 
 +
First, install wp-cli on your computer...
 +
 
 +
sudo add-apt-repository ppa:tiagohillebrandt/wp-cli
 +
sudo apt-get -y install wp-cli
 +
sudo -u www-data wp --info
 +
 
 +
Then, use a host entry in your ~/.ssh/config file for your server, then you can run this...
 +
 
 +
wp --ssh=host --user=jbloggs --path='/var/www/domain.com/html' core version
 +
 
 +
https://make.wordpress.org/cli/handbook/guides/running-commands-remotely/
 +
 
 +
=== Migrate Copy Your Site ===
 +
 
 +
'''WP-CLI'''
 +
 
 +
https://rocketgeek.com/basics/using-wp-cli-to-migrate-copy-your-site/
 +
 
 +
'''All-in-One WP Migration'''
 +
 
 +
[https://github.com/shameemreza/all-in-one-wp-migration/releases/tag/6.77 Fixed Old Version of All In One WP Migration 6.77] - use this to get around the paid for features...
 +
 
 +
# Install this version 6.77 of the plug-in on the staging host
 +
# Create a backup on staging site
 +
# Copy the wpress file to your new host
 +
# Install this version 6.77 of the plug-in on the new host
 +
# Create a quick backup to make the directory
 +
# Move the wpress file to that directory (wp-content/ai1wm-backups/)
 +
# Click on All-in-One WP Migration Backups
 +
# Choose the file and click Restore :)
 +
 
 +
=== Convert to Multisite ===
 +
 
 +
wp core multisite-convert --subdomains
 +
wp site list
 +
 
 +
https://developer.wordpress.org/cli/commands/core/multisite-convert/
 +
 
 +
https://developer.wordpress.org/cli/commands/site/
 +
 
 +
=== BackWPup ===
 +
 
 +
wp backwpup start <job-id>
 +
 
 +
https://backwpup.com/docs/starting-backup-job-immediately-or-scheduled/
 +
 
 +
=== Duplicate Post or Page ===
 +
 
 +
wp post create --from-post=123 --post_title='Different Title' --post_type=post
 +
wp post create --from-post=321 --post_title='Another Title' --post_type=page
 +
 
 +
https://developer.wordpress.org/cli/commands/post/create/
 +
 
 +
== HOWTO: CREATE: Child Themes ==
 +
 
 +
*FTP in to site
 +
*Navigate to <span style="background:#c0c0c0">wp-content</span> '''|''' <span style="background:#c0c0c0"> themes</span>
 +
*Create a new folder for the child theme, for example <span style="background:#c0c0c0">twentyfifteen-child</span> (where twentyfifteen is the name of your parent theme)
 +
*Create a text file named <span style="background:#c0c0c0">style.css</span>
 +
*Copy and paste the text from <span style="background:#c0c0c0">Example 1</span> below in to the <span style="background:#c0c0c0">style.css</span> file.
 +
 
 +
Example 1:
 +
 
 +
/*
 +
Theme Name: Example
 +
Theme URI: <nowiki>http://example.co.uk</nowiki>
 +
Description: Custom child theme
 +
Author: Why me of course
 +
Author URI: <nowiki>http://anotherexample.com</nowiki>
 +
Template: theme-child
 +
Version: 0.1
 +
*/
 +
 +
@import url("../theme/style.css");
 +
 
 +
*Next alter the text so it matches the details of the website the parent theme.
 +
 
 +
Example 2:
 +
 
 +
/*
 +
Theme Name: twentyeleven-child
 +
Theme URI: <nowiki>http://mywebsite.co.uk</nowiki>
 +
Description: Custom child theme
 +
Author: Fred Dibnah
 +
Author URI: <nowiki>http://dibnah-inc.com</nowiki>
 +
Template: twentyeleven
 +
Version: 0.1
 +
*/
 +
 +
@import url("../twentyeleven/style.css");
 +
 
 +
*FTP <span style="background:#c0c0c0">style.css</span> to <span style="background:#c0c0c0">wp-content</span> '''|''' <span style="background:#c0c0c0">themes</span> '''|''' <span style="background:#c0c0c0">twentyfifteen-child</span>
 +
*In the WordPress control panel navigate to <span style="background:#c0c0c0">Appearance</span> '''|''' <span style="background:#c0c0c0">Themes</span>
 +
 
 +
== HOWTO: REMOVE: Comment Box From An Existing Page ==
 +
 
 +
*All Pages
 +
*Select the 'Quick Edit' option
 +
*Un-tick 'Allow Comments'
 +
 
 +
== HOWTO: ALTER: Site URL ==
 +
 
 +
There are various methods to change the Site URL manually. Any of these methods will work and perform much the same function.
 +
 
 +
=== 1. Edit wp-config.php ===
 +
 
 +
It is possible to set the site URL manually in the wp-config.php file.
 +
 
 +
Add these two lines to your '''wp-config.php''', where "example.com" is the correct location of your site.
 +
 
 +
define('WP_HOME','<nowiki>http://example.com</nowiki>');
 +
define('WP_SITEURL','<nowiki>http://example.com</nowiki>');
 +
 
 +
=== 2. MySQL ===
 +
 
 +
Edit '''home''' and '''siteurl''' from the ''wp_options'' table using [https://www.phpmyadmin.net/ PHPMyAdmin] or similar.
 +
 
 +
=== 3. wp Command Line ===
 +
 
 +
'''A.''' You can use the official [https://developer.wordpress.org/cli/commands/ WP command line tool] to alter the 'home', 'siteurl' options.
 +
 
 +
cd /path/to/wordpress/files
 +
sudo -u user wp option get home
 +
sudo -u user wp option get siteurl
 +
sudo -u user wp option update home <nowiki>'http://www.domain.co.uk'</nowiki>
 +
sudo -u user wp option update siteurl <nowiki>'http://www.domain.co.uk'</nowiki>
 +
 
 +
https://developer.wordpress.org/cli/commands/option/
 +
 
 +
'''B.''' You can also use the command line to alter every part of the MySQL Database.
 +
 
 +
cd /path/to/wordpress/files
 +
sudo -u user wp search-replace <nowiki>'http://test.domain.co.uk'</nowiki> <nowiki>'http://www.domain.co.uk'</nowiki> --dry-run
 +
sudo -u user wp search-replace <nowiki>'http://test.domain.co.uk'</nowiki> <nowiki>'http://www.domain.co.uk'</nowiki>
 +
 
 +
https://developer.wordpress.org/cli/commands/search-replace/
 +
 
 +
== HOWTO: htaccess Extra Security Tweaks ==
 +
 
 +
<IfModule mod_rewrite.c>
 +
RewriteEngine On
 +
RewriteBase /
 +
RewriteRule ^index\.php$ - [L]
 +
RewriteCond %{REQUEST_FILENAME} !-f
 +
RewriteCond %{REQUEST_FILENAME} !-d
 +
RewriteRule . /index.php [L]
 +
# extra security tweaks
 +
RewriteRule ^wp-admin/includes/ - [F,L]
 +
RewriteRule !^wp-includes/ - [S=3]
 +
RewriteRule ^wp-includes/[^/]+\.php$ - [F,L]
 +
RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L]
 +
RewriteRule ^wp-includes/theme-compat/ - [F,L]
 +
</IfModule>
 +
 
 +
http://wordpress.org/download/
 +
 
 +
== HOWTO: Disable All Plugins Via PHPMyAdmin Or MySQL ==
 +
 
 +
mysql> update wp_options set option_value = "a:0:{}" where option_name = 'active_plugins';
 +
 
 +
Thanks to - http://www.webhostinghero.com/manually-disable-wordpress-plugins/
 +
 
 +
== HOWTO: WordPress Security ==
 +
 
 +
=== Plugins ===
 +
 
 +
# [https://wordpress.org/plugins/wordfence/ WordFence]
 +
# [https://wordpress.org/plugins/no-captcha-recaptcha/ reCAPTCHA]
 +
# [https://wordpress.org/plugins/health-check/ Health Check]
 +
# [https://hidemywpghost.com/hide-my-wp/ Hide My WP WordPress] and [https://hidemywpghost.com/article/how-to-set-hide-my-wp-for-bitnami-servers/ How to set up Hide my WP for Bitnami Servers]
 +
 
 +
=== Wordfence ===
 +
 
 +
Hands down, the best.
 +
 
 +
[https://www.wordfence.com/products/wordfence-cli/ NEW - Wordfence Command Line!]
 +
 
 +
==== Wordfence CLI ====
 +
 
 +
'''Setup'''
 +
 
 +
Download ...
 +
 
 +
cd /root/docker/
 +
git clone <nowiki>https://github.com/wordfence/wordfence-cli.git</nowiki>
 +
cd wordfence-cli/
 +
 
 +
Configure ...
 +
 
 +
docker run -v $(pwd):/root wordfence-cli:latest configure --configuration /root/.config/wordfence/wordfence-cli.ini --overwrite --default --accept-terms --request-license
 +
 
 +
Check ...
 +
 
 +
$ cat .config/wordfence/wordfence-cli.ini
 +
[DEFAULT]
 +
cache_directory = ~/.cache/wordfence
 +
license = 115e4a467b330ad5302cf1a50723f268e122a948d0e53f47d2417deeeea614xxxxxxxxxxxxxxxxxxxxxxx
 +
[MALWARE_SCAN]
 +
workers = 1
 +
 +
docker run -v $(pwd):/root wordfence-cli:latest version
 +
'''Wordfence CLI 5.0.1'''
 +
PCRE Supported: Yes - PCRE Version: 8.39 2016-06-14 (JIT Supported: Yes)
 +
Vectorscan Supported: No
 +
 
 +
Documentation ...
 +
 
 +
https://github.com/wordfence/wordfence-cli/blob/main/docs/Configuration.md
 +
 
 +
'''Usage'''
 +
 
 +
=== Password Protect Admin Folder Dashboard ===
 +
 
 +
https://www.wpbeginner.com/wp-tutorials/how-to-password-protect-your-wordpress-admin-wp-admin-directory/
 +
 
 +
=== Tutorials ===
 +
 
 +
[https://www.codeinwp.com/blog/secure-your-wordpress-website/ Secure Your WordPress Website]
 +
 
 +
[https://themeisle.com/blog/secure-wordpress-theme/ Secure WordPress Theme]
 +
 
 +
[https://www.wpbeginner.com/wordpress-security/ The Ultimate WordPress Security Guide]
 +
 
 +
=== Security Updates Mailing List ===
 +
 
 +
http://www.wordfence.com/subscribe-to-the-wordfence-email-list/
 +
 
 +
== HOWTO: WordPress Core: Add Page Last Modified Date ==
 +
 
 +
Add this code to your footer.php file...
 +
 
 +
<nowiki>Last modified: <?php the_modified_date(); ?></nowiki>
 +
 
 +
http://codex.wordpress.org/Template_Tags/the_modified_date
 +
 
 +
== HOWTO: WP-Members: Remove Powered By Link In Footer ==
 +
 
 +
Edit the file...
 +
 
 +
wp-content/plugins/wp-members/wp-members-dialogs.php
 +
 
 +
Search for 'powered by' and comment out both lines.
 +
 
 +
== HOWTO: Deactivate all plugins when unable to access the administrative menus? ==
 +
 
 +
* Via FTP or your host's file manager, navigate to the wp-contents folder (directory)
 +
* Via FTP or your host's file manager, rename the folder "plugins" to "plugins.hold"
 +
* Login to your WordPress administration menus (/wp-admin)
 +
* Via FTP or your host's file manager, rename "plugins.hold" back to "plugins"
 +
 
 +
http://codex.wordpress.org/FAQ_Troubleshooting
 +
 
 +
== DukaPress Shop Plugin ==
 +
 
 +
TO BE DONE.
 +
 
 +
== HOWTO: SET: The Home Page As A Static Page Instead Of Post ==
 +
 
 +
* Create a new page, it does not have to be called home.
 +
* Settings --> Reading --> Front page displays --> change from 'Your latest posts' to 'A static page (select below) and use the drop down menu to set the page required.
 +
* Click 'Save Changes'.
 +
* Optional: If you still want a 'Posts page' posts that option is also allowed for.
 +
 
 +
== HOWTO: SET: Menus As A Non-Clickable Top Level Item ==
 +
 
 +
This method only applies if you are using the default menu provided in WordPress.
 +
 
 +
First off do not create a page for the non-clickable as there is no need.
 +
 
 +
* WP Menu --> Appearance --> Menus
 +
* Links widget (under Pages in the left hand widget)
 +
* In the URL box change the contents 'http://' to '#' (without the quotes)
 +
* Add a label
 +
* Click the 'Add to Menu' button
 +
* Click the 'Save Menu' button
 +
 
 +
== WorldPay ==
 +
 
 +
TO BE DONE.
 +
 
 +
'''Test Credit Card Numbers''' - http://www.worldpay.com/support/kb/bg/testandgolive/tgl5103.html
 +
 
 +
== HOWTO: Permalinks (Page URL) - Alter ==
 +
 
 +
Go to:
 +
 
 +
Control Panel --> Settings --> Permalinks
 +
 
 +
Select 'Post name'
 +
 
 +
Finally click the 'Save Changes' button.
 +
 
 +
Or the more complicated method:
 +
 
 +
Add this to your .htaccess file...
 +
 
 +
# BEGIN WordPress
 +
<IfModule mod_rewrite.c>
 +
RewriteEngine On
 +
RewriteBase /
 +
RewriteRule ^index\.php$ - [L]
 +
RewriteCond %{REQUEST_FILENAME} !-f
 +
RewriteCond %{REQUEST_FILENAME} !-d
 +
RewriteRule . /index.php [L]
 +
</IfModule>
 +
# END WordPress
 +
 
 +
== Mobile Skin ==
 +
 
 +
http://wordpress.org/extend/plugins/wptouch/
 +
 
 +
== HOWTO: REMOVE: 'Home' Button ==
 +
 
 +
The code you need to modify is located in the TwentyTen Theme's functions.php file.
 +
 
 +
$args['show_home'] = false;
 +
 
 +
== PLUGIN: Yoast SEO ==
 +
 
 +
=== Use wp-cli ===
 +
 
 +
wp yoast index
 +
 +
Indexing posts  100% [==============================] 0:00 / 0:00
 +
Indexing terms  100% [==============================] 0:00 / 0:00
 +
Indexing post type archives  100% [=================] 0:00 / 0:00
 +
Indexing general objects  100% [====================] 0:00 / 0:00
 +
 
 +
To reset the index database, use this command ...
 +
 
 +
  wp yoast index --reindex
 +
 
 +
https://developer.yoast.com/features/wp-cli/reindex-indexables/
 +
 
 +
=== Fix Incorrect URL On Breadcrumbs Links After Site Move ===
 +
 
 +
# Install the Yoast Test Helper plugin, found here https://wordpress.org/plugins/yoast-test-helper/
 +
# Go to <code>Tools → Yoast Test</code>
 +
# Click the '''Reset Indexables tables and Migrations''' button
 +
# Go to <code>SEO → Tools</code>
 +
# Click the '''Start SEO Optimisation''' button and let it complete
 +
 
 +
https://wordpress.org/support/topic/after-the-change-of-domain-breadcrumbs-link-partly-still-old-url/
 +
 
 +
=== How To Hide Breadcrumbs On Home Page ===
 +
 
 +
body.home #breadcrumbs {
 +
  display: none;
 +
}
 +
 
 +
=== Useful Links ===
 +
 
 +
[https://gist.github.com/amboutwe/4b7a2f01366399281a53c355c5b78801/ Github Filters]
 +
 
 +
[http://hookr.io/plugins/yoast-seo/4.7.1/filters/ Custom Filters]
 +
 
 +
[https://wordpress.org/support/topic/dont-show-home-in-breadcrumbs/ Don't Show Home on Breadcrumbs]
 +
 
 +
== PLUGIN: Coming Soon and Maintenance Mode ==
 +
 
 +
https://en-gb.wordpress.org/plugins/coming-soon/
 +
 
 +
== PLUGIN: All-In-One WP Migration ==
 +
 
 +
[https://ryankozak.com/all-in-one-migration-sizelimit/ Size Limit Fix]
 +
 
 +
/wp-content/plugins/all-in-one-wp-migration/constants.php
 +
 
 +
// =================
 +
// = Max File Size =
 +
// =================
 +
define( 'AI1WM_MAX_FILE_SIZE', 536870912 * 8 );
 +
 
 +
== PLUGINS: Caching ==
 +
 
 +
https://www.elegantthemes.com/blog/resources/the-best-wordpress-cache-plugins-and-how-to-use-them
 +
 
 +
== HOWTO: FIX: ==
 +
 
 +
=== Error: Undefined index: HTTP_X_FORWARDED_PROTO with WP-CLI ===
 +
 
 +
Change the lines in your '''wp-config.php''' to these ...
 +
 
 +
define('FORCE_SSL_ADMIN', true);
 +
define('FORCE_SSL_LOGIN', true);
 +
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'){ $_SERVER['HTTPS']='on'; }
 +
 
 +
https://randomadult.com/fix-undefined-index-http_x_forwarded_proto-with-wp-cli/
 +
 
 +
=== Missing Appearance Menus in Dashboard ===
 +
 
 +
https://www.wpbeginner.com/beginners-guide/how-to-fix-missing-appearance-menu-in-wordpress-admin/
 +
 
 +
=== Error: Minified React error #31 ===
 +
 
 +
This seems to be a NginX bug with the Gutenberg Editor and is part of the Tools > Site Health error "REST API is not working correctly."
 +
 
 +
Change all your lines with this...
 +
 
 +
try_files $uri $uri/ /index.php;
 +
 
 +
To this...
 +
 
 +
try_files $uri $uri/ /index.php$is_args$args;
 +
 
 +
Restart NginX and PHP FPM...
 +
 
 +
sudo systemctl restart php7.4-fpm.service nginx.service
 +
 
 +
https://developer.wordpress.org/rest-api/frequently-asked-questions/#query-parameters-are-not-working
 +
 
 +
=== Error: Sorry, you are not allowed to edit posts in this post type ===
 +
 
 +
This is probably because it is a post type of revision...
 +
 
 +
sudo -u www-data wp post get 449
 +
...
 +
post_name            | 230-revision-v1
 +
post_type            | revision
 +
 
 +
=== Error: changeset_post_save_failure ===
 +
 
 +
This is caused by a faulty PHP file in the WordPress installation and a possible MySQL database corruption.
 +
 
 +
Use wp command line to backup the database, then clear the database, then force upgrade the WP install.
 +
 
 +
  sudo -i
 +
  sudo -u www-data -E wp db export wp_db_export_file.sql
 +
  chown www-data:www-data wp_db_export_file.sql
 +
  cp -av wp_db_export_file.sql ~/
 +
  cp -av wp-config.php ~/
 +
  sudo -u www-data -E wp db reset --yes
 +
  service mysql restart
 +
  sudo -u www-data -E wp db import wp_db_export_file.sql
 +
  sudo -u www-data -E wp db check
 +
  sudo -u www-data -E wp db tables
 +
  sudo -u www-data -E wp core update --force --locale=en_GB
 +
  sudo -u www-data -E wp core update-db
 +
  sudo -u www-data -E wp core verify-checksums --locale=en_GB
 +
 
 +
=== Error: Wordfence Update Error ===
 +
 
 +
If you see this error when updating Wordfence in the WordPress Dashboard...
 +
 
 +
Installing Plugin: Wordfence Security x.x.x
 +
Downloading install package from <nowiki>https://downloads.wordpress.org/plugin/wordfence.x.x.x.zip</nowiki>…
 +
Unpacking the package…
 +
Could not copy file. wordfence/xxxxx/xxxxxx
 +
 
 +
You need to go to /wp-content/upgrade/ and delete all the wordfence folders/files in there. Chances are you won't be able to do that via FTP due to chown problems but will need shell access to your server to get rid of them. After that is done you will be able to upgrade without a problem.
 +
 
 +
cd /home/user/www/wp-content/
 +
sudo rm -rfv upgrade/*
 +
 
 +
Thanks - https://wordpress.org/support/topic/update-error-v-517
  
=== Error: Wordfence Update Error ===
+
=== Wordfence Central ===
  
If you see this error when updating Wordfence in the WordPress Dashboard...
+
Head over to Wordfence Central, go to the Connection Issues tab. Clear out any sites that might be in here.
  
Installing Plugin: Wordfence Security x.x.x
+
Now go back to your site and log in as an admin. Navigate to Tools > Diagnostics > Other Tests > Clear all Wordfence Central connection data. Clear the connection data, which it looks like you already tried, then from the Wordfence Dashboard, click on “Connect this site” in the Wordfence Central widget.
Downloading install package from https://downloads.wordpress.org/plugin/wordfence.x.x.x.zip…
 
Unpacking the package…
 
Could not copy file. wordfence/xxxxx/xxxxxx
 
 
 
You need to go to /wp-content/upgrade/ and delete all the wordfence folders/files in there. Chances are you won't be able to do that via FTP due to chown problems but will need shell access to your server to get rid of them. After that is done you will be able to upgrade without a problem.
 
  
cd /home/user/www/wp-content/
+
https://www.wordfence.com/help/central/connect/#troubleshooting-connection-issues also has some troubleshooting steps you could follow.
sudo rm -rfv upgrade/*
 
 
 
Thanks - https://wordpress.org/support/topic/update-error-v-517
 
  
 
=== Lighttpd Permalinks ===
 
=== Lighttpd Permalinks ===
Line 1,843: Line 2,544:
  
 
  Installing Plugin: Disable Author Pages 0.7
 
  Installing Plugin: Disable Author Pages 0.7
  Downloading install package from https://downloads.wordpress.org/plugin/disable-author-pages.zip…
+
  Downloading install package from <nowiki>https://downloads.wordpress.org/plugin/disable-author-pages.zip</nowiki>…
 
  Unpacking the package…
 
  Unpacking the package…
 
  The package could not be installed. PCLZIP_ERR_BAD_FORMAT (-10) : Unable to find End of Central Dir Record signature
 
  The package could not be installed. PCLZIP_ERR_BAD_FORMAT (-10) : Unable to find End of Central Dir Record signature

Latest revision as of 14:09, 22 November 2024

Installation

to be done

Local WP

Local WP - Latest Ubuntu DEB

= Time Limited Test Instant WordPress Sites

TasteWP

InstaWP

Allow WebP Images

Plugins > WPCode Lite > Snippets > Add New > Add Your Custom Code (New Snippet) > PHP Snippet > "Allow WebP Image Files" >

function cc_mime_types($mimes) {
    $mimes['webp'] = 'image/webp';
    return $mimes;
}
add_filter('upload_mimes', 'cc_mime_types');

SSL When Using A Reverse Proxy

If WordPress is hosted behind a reverse proxy that provides SSL, but is hosted itself without SSL, these options will initially send any requests into an infinite redirect loop. To avoid this, you may configure WordPress to recognize the HTTP_X_FORWARDED_PROTO header (assuming you have properly configured the reverse proxy to set that header).

define('FORCE_SSL_ADMIN', true);
// in some setups HTTP_X_FORWARDED_PROTO might contain
// a comma-separated list e.g. http,https
// so check for https existence
if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
$_SERVER['HTTPS']='on';

https://wordpress.org/support/article/administration-over-ssl/#using-a-reverse-proxy

Enable Theme Editor

define( 'DISALLOW_FILE_EDIT', false );

Create Blank Page Templates

https://wordpress.org/plugins/fullwidth-templates/

Keyboard Shortcuts

The shortcut Alt + Shift + H (Option + Control + H for Mac) actually is the most useful shortcut because it shows you all the keyboard shortcuts.

CTRL + S = Save 

https://www.wpbeginner.com/beginners-guide/21-most-useful-time-saving-wordpress-shortcuts/

Cookies

https://wordpress.org/plugins/cookie-law-info/

https://www.civicuk.com/cookie-control/download

https://wordpress.org/plugins/civic-cookie-control-8/

Version 5.4

Disable Default Fullscreen Edit Mode

You’ll need to simply enter the following code in your WordPress theme’s functions.php file, or in a site-specific plugin. You can also use the custom code snippets plugin to add this code to your site without conflicts.

if (is_admin()) { 
    function jba_disable_editor_fullscreen_by_default() {
    $script = "jQuery( window ).load(function() { const isFullscreenMode = wp.data.select( 'core/edit-post' ).isFeatureActive( 'fullscreenMode' ); if ( isFullscreenMode ) { wp.data.dispatch( 'core/edit-post' ).toggleFeature( 'fullscreenMode' ); } });";
    wp_add_inline_script( 'wp-blocks', $script );
}
add_action( 'enqueue_block_editor_assets', 'jba_disable_editor_fullscreen_by_default' );
}

https://www.wpbeginner.com/wp-tutorials/how-to-disable-fullscreen-editor-in-wordpress/

Security

How To Disable XML-RPC

Edit your theme's functions.php file and add the following line...

// disable xmlrpc
add_filter('xmlrpc_enabled', '__return_false');

How To Deny Access To XML-RPC

Lighttpd

Edit your your vhost file...

url.access-deny = ( "xmlrpc.php" )

Apache

Edit the .htaccess file...

<Files xmlrpc.php>
 order deny,allow
 deny from all
</Files>

NginX

Edit your your vhost file...

location /xmlrpc.php {
   deny all;
}

How To Remove The WordPress Version Number

Edit your theme's functions.php and add the following line...

// remove version from head
remove_action('wp_head', 'wp_generator');
// remove version from rss
add_filter('the_generator', '__return_empty_string');
// remove version from scripts and styles
function shapeSpace_remove_version_scripts_styles($src) {
  if (strpos($src, 'ver=')) {
    $src = remove_query_arg('ver', $src);
  }
  return $src;
}
add_filter('style_loader_src', 'shapeSpace_remove_version_scripts_styles', 9999);
add_filter('script_loader_src', 'shapeSpace_remove_version_scripts_styles', 9999);

Thanks

MySQL Performance

Non Bitnami Server

sudo nano /etc/mysql/my.cnf
  [mysqld]
  performance_schema = OFF
sudo service mysql restart  (or  sudo systemctl restart mysql.service)

Thanks

Bitnami Server

sudo nano /opt/bitnami/mysql/my.cnf
  [mysqld]
  performance_schema = OFF
sudo /opt/bitnami/ctlscript.sh restart mysql

Remove Rest API From Header

https://thomas.vanhoutte.be/miniblog/remove-api-w-org-rest-api-from-wordpress-header/

Giving WordPress Its Own Directory

There are 2 ways to do this...

  1. without URL change (e.g. domain.com/)
  2. with URL change (domain.com/wordpress/)

https://wordpress.org/support/article/giving-wordpress-its-own-directory/

Organise Media Library with Categories

Happy Files

Amazon Polly Audio

https://docs.aws.amazon.com/polly/latest/dg/plugin.html

Google SiteKit

https://sitekit.withgoogle.com/

https://github.com/google/site-kit-wp/releases

SEO

  1. Stay active on social media.
  2. Focus on building quality backlinks.
  3. Establish yourself as an expert in your niche.
  4. Experiment with different types of content.
  5. Improve your website's performance.

Ranking Factors

Yoast SEO Webmaster Tools

Google Analytics SEO Tips

Google Analytics 4 Basic (SEO) Guide

Email

SMTP

Fluent SMTP

Forms

Fluent Forms

Fluent Forms Notification Email From Dropdown Address

The .value at the end of a field name is the key, otherwise you would get the Label.

{inputs.dropdown-name-attribute.value}

https://twitter.com/Fluent_Forms/status/1553958492813533184

Royalty Free Images

PixaBay

PixNio

Flickr

Best Free Stock Photo Web Sites

Contact Form 7

How to Hide the Recaptcha box

WPforms

Add field values for Dropdown, Checkboxes, and Multiple Choice fields

Fix Google reCAPTCHA

https://blog.laurencebichon.com/fix-wpforms-captcha-not-working-with-amp-google-recaptcha-v3/

FIX: ERROR: Another update is currently in progress

It is an automatic lock to prevent simultaneous core updates. It will be gone after 15 minutes. If you don't want to wait, delete the record from options table – usually wp_options.

sudo -u ftpuser wp option delete core_updater.lock

Success: Deleted 'core_updater.lock' option.

Thanks

Disable Automatic Updates

You can disable automatic updates in WordPress by adding this line of code in your wp-config.php file:

define( 'WP_AUTO_UPDATE_CORE', false );

Change Post Types

Rename the default 'Posts' to 'News' or something else

Performance Tweaks

Why Is WordPress Slow?

However, many factors can affect your WordPress site’s performance. Some of the most common ones include:

  • Your site’s web hosting provider
  • Server-side optimizations (PHP version, caching, compression, etc.)
  • Sluggish WordPress themes
  • Slow WordPress plugins
  • Unoptimized content (mainly images)
  • Too many external HTTP requests
  • Not using a dedicated resource to serve content (CDN, video hosting, etc.)

Performance Checklist

Hidden Options

https://www.mydomain.com/wp-admin/options.php

Host Google Services Locally

Google Analytics

Google Fonts

Remove Lots

TrimPress

Autoptimize

Asset Cleanup

Remove Emoji Code

Add the following lines to the bottom of your theme's functions.php file...

remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'wp_print_styles', 'print_emoji_styles' );

Thanks

Remove Type Attribute From JavaScript Tags

Add the following lines to the bottom of your theme's functions.php file...

add_action(
  'after_setup_theme',
    function() {
      add_theme_support( 'html5', [ 'script', 'style' ] );
    }
);

Thanks

Compression

Enable...

https://www.tweaked.io/guide/lighttpd/

Test...

curl -I --compressed <url>

Image Compression

tinyPNG

Smush

Render Blocking

https://varvy.com/pagespeed/render-blocking-css.html

https://varvy.com/pagespeed/defer-loading-javascript.html

CDN

Cloudinary

Cloudinary is the media management platform for web and mobile developers. An end-to-end solution for all your image and video needs.

Cloudinary Media Performance CDN - WordPress Plugin

Caching

WordPress 6.1 and later now includes checks for Page Cache and Object Cache in the Site Health tool.

How do I disable the cache checks? Add these code snippets:-

function disable_full_page_cache_check( $tests ) {
    unset( $tests['async']['page_cache'] );
    return $tests;
}
add_filter( 'site_status_tests', 'disable_full_page_cache_check' );
function disable_object_cache_check( $tests ) {
    unset( $tests['direct']['persistent_object_cache'] );
    return $tests;
}
add_filter( 'site_status_tests', 'disable_object_cache_check' );

WordPress Caching

Caching strategy is a key decision for any WordPress site for speed and performance. There are typically 4 levels of caching recommended for WordPress. Here is a description of how we will set up caching for WordPress with Docker:

Browser Caching: This is what tells the visitors browser to cache the files locally to speed up future site/page visits. We will set this up using Nginx. On Apache, this is accomplished using .htaccess files.

Server Caching: This caches static versions of pages (Page cache). We are going to accomplish this using Nginx FastCGI cache.

Frontend Caching: This means caching WordPress PHP files so they don't have to be re-compiled for every visit. We are going to set this up using PHP OpCache.

Database Caching: This optimizes database queries by storing them in the RAM for faster delivery. We are going to use Redis for this.

As mentioned before, I have Cloudflare and Ezoic Site Speed+ that serve cached and optimized content to visitors. But even without those, the above caching strategy should deliver excellent speeds.

https://www.smarthomebeginner.com/wordpress-on-docker-traefik/


Here is a quick list of the different types of caching we can identify:

  • Page cache: it happens on the server and stores the entire HTML of a page (as WP Rocket does);
  • Browser cache: it keeps storing the HTML but occurs on the browser;
  • Object cache: it stores database queries;
  • Bytecode cache: it's a PHP extension and stores precompiled script bytecode in the memory;
  • CDN cache: it occurs on the CDN-side and stores the HTML and all other static files (images, CSS and JS);
  • Reverse proxy cache: it happens on the server's side and stores all its responses to the client's server.

Browser Caching

For Apache .htaccess ...

<IfModule mod_expires.c>
  ExpiresActive on
  
  # whitelist expires rules
  ExpiresDefault "access 1 month"
 
  # Favicon (cannot be renamed)
  ExpiresByType image/x-icon "access plus 1 week"
 
  # Media: images, video, audio
  ExpiresByType image/gif "access plus 1 month"
  ExpiresByType image/png "access plus 1 month"
  ExpiresByType image/jpg "access plus 1 month"
  ExpiresByType image/jpeg "access plus 1 month"
  ExpiresByType video/ogg "access plus 1 month"
  ExpiresByType audio/ogg "access plus 1 month"
  ExpiresByType video/mp4 "access plus 1 month"
  ExpiresByType video/webm "access plus 1 month"
 
  # Webfonts
  ExpiresByType application/x-font-ttf "access plus 1 month"
  ExpiresByType font/opentype "access plus 1 month"
  ExpiresByType application/x-font-woff "access plus 1 month"
  ExpiresByType image/svg+xml "access plus 1 month"
 
  # CSS and JavaScript
  ExpiresByType text/css "access plus 1 month"
  ExpiresByType text/javascript "access plus 1 month"
  ExpiresByType application/javascript "access plus 1 month"
 
  <IfModule mod_headers.c>
    Header append Cache-Control "public"
  </IfModule>
</IfModule>

https://www.tweaked.io/guide/lighttpd/

KeyCDN Cache Enabler

Tutorial

WordPress Plugin

Content Delivery Network Pricing

KeyCDN - Getting Started

KeyCDN - WordPress CDN Integration with CDN Enabler

After installing, make sure all the pages get generated in the cache with this script - Use wget to scrape all URLs from a sitemap.xml

Check the bottom of the page's source code for the following...

<!-- Cache Enabler by KeyCDN @ 21.04.2020 22:17:15 (html) -->

W3 Total Cache

W3 Total Cache - Simple Introduction Tutorial

W3 Total Cache - Extensive Tutorial

W3 Total Cache - WordPress Plugin Page

How can I tell if if the cache plugin is working?

You can open the source code of a page (Google Chrome) View > Developer > View Source and scroll to the bottom. You should see an HTML-comment that states the site was cached by W3 Total Cache.

Perf Matters

This is a paid-for plugin that does an amazing selection of optimisation for WordPress. Seriously, everything.

https://perfmatters.io/features/

WP Rocket

WP Rocket No Cache - Disables WP Rocket’s page cache while preserving other optimization features.

HTTP/2

HTTP/2 For Web Developers

Disable WP Cron

This is a bit of a unsure one, if you do this it will make other things moan and it's really not worth it...

define('DISABLE_WP_CRON', true);

Links

Perf Matters

Performance Lab (WebP and Cache) Plugin

Improve WordPress Web Site Performance

UpTrends Web Site Speed Test

Varvy PageSpeed Tests

GTMetrix WordPress Web Site Analysis and Performance Tool

Google PageSpeed Tests

PNG2JPG

Oxygen Builder - Speed Up WordPress in 2019: How To Optimize Your Website & Make It Load Fast

WordPress Optimisation - Need to be < 3 secs load time

Accessibility Skip To Main Content

One of the earliest solutions in all of web accessibility was the "skip to main content" link, a same page link at the top of the page that enables users to skip past navigation links and go straight to the main content of the web page. Despite the fact that these links have been in use since the early 1990's, they actually aren't implemented well at all by browsers. They can be a huge benefit to sighted non-mousers (navigating by keyboard) but they don't work for these users in any browser other than Firefox and Internet Explorer, and they don't even work in IE unless link targets have tabindex="0".

<div id="skiplink-container">
   <div>
     <a href="#content" class="skiplink">Skip to main content</a>
   </div>
 </div>
 
 <div>
   <main role="main" id="content" tabindex="-1">
   ...
   content in here
   ...
   </main>
 </div>

https://www.w3schools.com/tags/tag_main.asp

Gutenberg

How to add more Columns

The default columns block uses two columns, but you can add up to six columns in one column block.

To increase the number of columns, click somewhere in the column block but outside of the blocks within it. You'll see the settings in the sidebar switch from the Document settings to the Block settings revealing extra options. You can use the slider or the number input to adjust the number of columns from 2-6.

https://www.competethemes.com/blog/wordpress-make-columns/

Elementor

Fix Mixed Content Error on SSL

First, search and replace all references to non secure addresses...

Dashboard > Elementor > Tools > Replace URL > http://www.thisdomain.co.uk -- https://www.thisdomain.co.uk

https://docs.elementor.com/article/218-i-changed-the-url-of-my-website-and-elementor-does-not-work-anymore

Second, clear the Cache from WP Rocket or similar...

Dashboard > WP Rocket > Clear Cache

Change Default Font

How To Change The Default Font In Elementor (Step By Step) – ThemeWaves

Fix Update Database Error

This command will update the database, if an update is needed...

wp elementor update db

This command will update the Elementor Pro database, if an update is needed...

wp elementor-pro update db

This command will update the database even if another process is running...

wp elementor update db --force

This command will update the database for each site in the network...

wp elementor update db --network

https://developers.elementor.com/docs/cli/update-db/

Divi

Updates

Changelog

Customise For Mobile View

Divi > Theme Customizer link within your WordPress Dashboard. Next look for the Mobile Styles panel and open it to reveal the mobile styling options. You will notice 3 sections within the Mobile Styles panel: Tablet, Phone and Mobile Menu.

Remove Divi Menu Drop Shadow

#main-header, #main-header.et-fixed-header {
    -webkit-box-shadow: none!important;
    -moz-box-shadow: none!important;
    box-shadow: none!important;
}

Icons

https://www.elegantthemes.com/blog/resources/elegant-icon-font

Breakdance

Breakdance is an easy-to-use visual site builder for WordPress. It allows you to build websites from start to finish - including custom headers, footers, blog templates and dynamic page layouts - all without touching a line of code.

Breakdance is a new WordPress page builder focused on both power and speed. The builder was recently released in September 2022 and features over 120 block elements usable through a drag & drop UI.

It has been created by the makers of Oxygen and combines the best parts of Oxygen withe best parts of Bricks and Elementor.

Review with List of Features

Why Breakdance?

Official Web Site

Documentation

Roadmap

YouTube Channel

Feature Requests

RSS News Feed

Global Settings

Typography

Heading Font Yabe Webfont
Body Font Yabe Webfont

Advanced > Headings

H1 = clamp(2.4rem, calc(2.4rem + ((1vw - 0.32rem) * 0.8333)), 3.2rem)
H2 = clamp(2.0rem, calc(2.0rem + ((1vw - 0.32rem) * 0.625)), 2.8rem)
H3 = clamp(1.8rem, calc(1.8rem + ((1vw - 0.32rem) * 0.2083)), 2.2rem)
H4 = clamp(1.3rem, calc(1.3rem + ((1vw - 0.32rem) * 0.4167)), 1.8rem)
H5 = clamp(1.1rem, calc(1.1rem + ((1vw - 0.32rem) * 0.4167)), 1.4rem)
H6 = clamp(1.0rem, calc(1.0rem + ((1vw - 0.32rem) * 0.4167)), 1.2rem)

This, just doesn't seem to work (hopefully AutomaticCSS will come to the rescue soon!) so I have put some fixed viewport settings here for now:-

Desktop = 3.0rem
Tablet Landscape = 2.7rem
Tablet Portrait = 2.0rem
Phone Landscape = 1.8rem
Phone Portrait = 1.6rem

Containers

Sections
Responsive Size Vertical Padding Horizontal Padding
Desktop 80 px 32 px
Tablet Landscape 70 px 28 px
Tablet Portrait 55 px 22 px
Phone Landscape 45 px 18 px
Phone Portrait 30 px 12 px

Tips

Fix Gutenberg

Breakdance > Settings > Performance > untick 'Remove Gutenberg Blocks CSS', then add the following code to CSS which fixes flex rows ...

.breakdance figure {
  width: unset;
}

Globally Change Colour Of Icon On Menu Builder Dropdown

Menu Builder / Desktop Menu / Dropdowns / Links / Graphic / Icon

Reduce Height Of Sticky Header On Scroll

Size on desktop 100px
Spacing / Padding 0
Sticky / Style / Minimum height 60px

Templates

https://bdlibraryawesome.com/

Oxygen Builder

Introduction

Oxygen is a plugin that replaces the Theme system in WordPress. It allows you to build your own Templates for use in any page. It produces the most efficient code and the fastest loading web sites.

Features

https://wparena.com/oxygen-review/

Purchase

https://oxygenbuilder.com/pricing

Installation

Plugins > Add New > Upload Plugin > Browse > Install Now

Documentation

https://oxygenbuilder.com/documentation/

Changelog

https://oxychangelog.com

Support

Slack - Oxygen Builder General Support

Oxygen - Official Support

Github - Oxygen Bugs and Features

Roadmap

Using Oxygen with Elementor

Yeah, I know, why the **** would you want to? But, it's possible ...

Oxygen > Templates > New Template > Add Sections for header + main + footer, then in the main section add a Code Block with the PHP ...

<?php the_content(); ?>

... and then you can install the Elementor plugin, edit the page and watch as 100's of lines are added to your code :)

But, it's easy to use, right?

Tips

Performance

Oxygen seems to load quicker in Mozilla Firefox.

https://oxygen4fun.supadezign.com/tips/useful-optimizations-for-oxygen-builder/

Responsive

NONE OF THIS IS NEEDED IF YOU BUY AND USE AUTOMATIC.CSS


Fluid Resposive Font Size Calculator

Fonts

Before we get down to tweaking, here is the list of default settings for the Fonts in Global Styles:-

Headings
H1 - Font Size = 36px + Font Weight = 700
H2 - Font Size = 30px
H3 - Font Size = 24px
H4 - Font Size = 20px
H5 - Font Size = 18px
H6 - Font Size = 16px

Body Text
Text - Font Size = 16px + Font Weight = 400 + Line Height = 1.6 + Colour = #404040

CSS clamp()

CSS clamp is a function that sets responsive unit sizes without any media queries. The function takes 3 parameters in this order:

  1. min - where to start scaling from.
  2. viewport width - the range determines how fast the min scales to the max based on the screen getting larger.
  3. max - when to stop scaling.

Add CSS

Oxygen > Templates > Edit Template > Manage > Stylesheets > Add Stylesheet > Clamp

/* Base */

html {
  font-size: 62.5%;
}

Add Clamp

Oxygen > Templates > Edit Template > Manage > Settings > Global Styles > Headings

H1 = clamp(3.2rem, calc(3.2rem + ((1vw - 0.32rem) * 1.6667)), 4.8rem)
H2 = clamp(2.8rem, calc(2.8rem + ((1vw - 0.32rem) * 1.0417)), 3.8rem)
H3 = clamp(2.4rem, calc(2.4rem + ((1vw - 0.32rem) * 0.8333)), 3.2rem)
H4 = clamp(2.2rem, calc(2.2rem + ((1vw - 0.32rem) * 0.625)), 2.8rem)
H5 = clamp(2rem, calc(2rem + ((1vw - 0.32rem) * 0.2083)), 2.2rem)
H6 = clamp(1.4rem, calc(1.4rem + ((1vw - 0.32rem) * 0.4167)), 1.8rem)

Oxygen > Templates > Edit Template > Manage > Settings > Global Styles > Body Text

Font Size = clamp(1.4rem, calc(1.4rem + ((1vw - 0.32rem) * 0.4167)), 1.8rem)

https://www.youtube.com/watch?v=aO7QeE53Aqg

Sections and Columns

Oxygen > Templates > Edit Template > Manage > Settings > Global Styles > Sections and Columns

Here are the default settings for Section and Columns in Oxygen Builder ...

Section Container Padding
TOP = 75px
BOTTOM = 75px
LEFT = 20px
RIGHT = 20px

Columns Padding
TOP = 20px
BOTTOM = 20px
LEFT = 20px
RIGHT = 20px

New values ...

Section Container Padding

TOP = clamp(1rem, calc(1rem + ((1vw - 0.32rem) * 1.0417)), 2rem)
BOTTOM = clamp(1rem, calc(1rem + ((1vw - 0.32rem) * 1.0417)), 2rem)
LEFT = 2rem
RIGHT = 2rem

Columns Padding

Delete all values then change to 'none'.

https://www.youtube.com/watch?v=aO7QeE53Aqg

Images

SRCSET - The srcset attribute is giving the browser several different options to choose from depending on the size parameters. The browser will choose the smallest image that still matches the specified size parameters.

Learn how to register custom image sizes in WordPress and use SRCSET functionality in Oxygen for fully responsive images...

https://www.youtube.com/watch?v=0jc74V5wYRk

https://digitalambition.co/watch/responsive-srcset-images-in-oxygen-register-use-custom-sizes/

https://creativesfeed.com/responsive-images-with-srcset/

Sticky Shrinking Header

https://isotropic.co/sticky-shrinking-header-in-oxygen-builder-that-hides-on-scroll-down/

Miscellaneous

https://oxywp.com/en/home-page/

Tags and Lists

Basic Component Lists in Oxygen Builder

Add-Ons

Automatic CSS

Automatic.css is the Most Practical, No-Nonsense Utility Framework Ever Created for Oxygen Builder.

  • Automatic Typography
  • Automatic Colours
  • Automatic Spacing

Automatic CSS - Tweak Oxygen Before Install

Automatic CSS - Home Page

Automatic CSS - Changelog

Automatic CSS - Setup

Holding Page

Floating logo...

Add > Div > center--all , height--full , pad--m

<div id="div_block-2-10" class="ct-div-block center--all height--full pad--m" >

Negative Values

margin-top: calc(var(--space-xxl) * -1);
Recoda WorkSpace

Recoda WorkSpace for Oxygen Builder | Getting Started | Changelog

Command Line

section@Name#id'tag.class

Install the Recoda plugin, start a new Template, press g on your keyboard, paste any of these lines and press enter ...

HEADER

section@Header#header'header.header

MAIN

section@Main#main'main.main

FOOTER

section@Footer#footer'footer.footer

ALL 3 SECTIONS TOGETHER

section@Header#header'header.header+section@Main#main'main.main+section@Footer#footer'footer.footer

COMPLEX FOOTER WITH 3 COLUMNS

section@Footer#footer'footer.footer.grid--3.pad-section--xs.grid--m-1.gap--l>div>txt{Lorem ipsum dolor sit amet. Id magnam sint et inventore temporibus non soluta aperiam est quos tempora sed galisum quia.}^1*3
Others

Edit CSS Outside Oxygen - for this, install WP Code Snippets > Add New > Custom > Type: PHP > Paste PHP Code > Save > Activate

OxyProps - CSS Custom Properties right in Oxygen Builder

OxyExtras

Hydrogen Pack - tweaks for Oxygen Builder

OxyNinja - Core Design and UI Set

OxyNinja Framework Cheatsheet

OxyMade - Design Set and Framework for Oxygen Builder

Oxygen Builder Addons

Nimbufy - Bring any web page layout into Oxygen Builder

Multi-User Collaboration

How To Install Analytics Using Code Snippets

https://wordpress.org/plugins/code-snippets/

Dashboard > Snippets > Add New >

add_action( 'wp_head', 'matomo_analytics' );
/**
 * Adds Matomo Analytics code in <head> below the <title>.
 */
function matomo_analytics() { ?>

<script>
  var _paq = window._paq = window._paq || [];
  /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function() {
    var u="https://matomo.domain.uk/";
    _paq.push(['setTrackerUrl', u+'matomo.php']);
    _paq.push(['setSiteId', '24']);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
  })();
</script>

<?php }

https://permaslug.com/how-to-install-google-analytics-in-wordpress/

How To Clone A Template

Under "Edit with Oxygen" you can click on shortcode and copy the content, then create a new template, click on shortcode, paste it and save it. Done.

How To Copy An Entire Web Site

To copy an entire WordPress install with all of your content, plugins, settings, and everything else, you can use a plugin like All-in-One WP Migration.

Once you've created a .wpress package with All-in-One WP Migration, import the package on the target site and do the following:

  1. Save your permalinks twice via Settings > Permalinks
  2. Resign your shortcodes via Oxygen > Settings > Security
  3. Regenerate your CSS cache via Oxygen > Settings > CSS Cache
  4. Check to verify that everything looks and works as you expect

You may also need to open each template in the admin area and click the Update button on the right-hand side, but this is rare if you have followed the above steps.

https://oxygenbuilder.com/documentation/other/importing-exporting/

Custom Fonts

https://www.youtube.com/watch?v=3pqOKtdiCTM

Dark Mode

https://www.youtube.com/watch?v=CzfP3-xwoiM

Paste this in to a Code Block

https://smoothwebsites.net/tutorials/how-to-implement-a-dark-mode-toggle-in-oxygen/

https://permaslug.com/dark-mode-in-oxygen/

Google Analytics

Plugins

Simple Universal Google Analytics

Google Analytics Dashboard for WP (GADWP)

Ecommerce - Shopify

https://www.shopify.com/buy-button/wordpress

https://www.shopify.co.uk/lite

Ecommerce - WooCommerce

How to create more than 50 product variations in WooCommerce

define( 'WC_MAX_LINKED_VARIATIONS', 100 );

https://www.proy.info/create-more-than-50-product-variations-in-woocommerce/

Hide Downloads Tab on My Account page

Dashboard > WooCommerce > Settings > Advanced > Account Endpoints > delete the text in the 'downloads' box

Account endpoints - Endpoints are appended to your page URLs to handle specific actions on the accounts pages. They should be unique and can be left blank to disable the endpoint.

Products Sorting

How to Change Default WooCommerce Product Sorting

  1. Method one – use the customise setting to change default product sorting
  2. Method two – Drag and Drop product sorting

Add Customers

https://fluentsmtp.com/manually-add-customers-to-woocommerce/

Setup Wizard

You can run the Setup Wizard, if you skipped it when installing WooCommerce. Go to: Help > Setup Wizard and select Setup Wizard.

https://docs.woocommerce.com/document/woocommerce-setup-wizard/#section-6

Categories

https://atlantisthemes.com/woocommerce-categories/

Code Snippets

https://www.tychesoftwares.com/woocommerce-shop-page-hooks-visual-guide-with-code-snippets/

Hide Product Count

.woocommerce-result-count {
  display: none;
}

Show Arrow On Drop-Down Sorting Menu On Product Pages

.breakdance-woocommerce select {
  -moz-appearance: auto;
  -webkit-appearance: auto;
  appearance: auto;
  height: auto;
  width: auto;
}

Show Product Categories on Theme Menus

Appearance > Menus > Screen Options (at top of page) > tick Product Categories

Show Product Categories on Shop Page

  1. Click on Appearance > Customize
  2. Then go to WooCommerce > Product Catalog
  3. Select show categories from Shop Page Display
  4. Click on Save Changes

Customise Breadcrumb

https://docs.woocommerce.com/document/customise-the-woocommerce-breadcrumb/

Accompanying Plugins

Request a Quote for WooCommerce

WooCommerce Quotation / Request For Quote Plugin

Request A Quote

Shortcodes

WooCommerce cannot function properly without the first three shortcodes being somewhere on your site.

[woocommerce_cart] – shows the cart page
[woocommerce_checkout] – shows the checkout page
[woocommerce_my_account] – shows the user account page
[woocommerce_order_tracking] – shows the order tracking form

https://docs.woocommerce.com/document/woocommerce-shortcodes/

Custom Related Products

https://wordpress.org/plugins/custom-related-products-for-woocommerce/

Google Products Integration

https://woocommerce.com/products/google-listings-and-ads/

https://www.searchenginejournal.com/google-integrates-with-woocommerce-for-easy-product-uploads/410082/amp/

Command Line Updating Database

This will update the WooCommerce database using wp-cli on a WordPress Multisite install...

export WP_CLI_CACHE_DIR=/var/www/domain.co.uk/.wp-cli/cache; sudo -u www-data -E wp --path='/var/www/domain.co.uk/html/' --url='https://sub.domain.co.uk/' wc update

Square Payment Plug-In

The Square Digital Wallet option for WooCommerce is lovely and all, but it means you can get around the Order Limit plug-in.

The fix?

Install the WPCode Lite plug-in then add a PHP Snippet called 'WooCommerce Square Hide Digital Wallet' with this code in it ...

add_filter( 'wc_square_display_digital_wallet_on_pages', function( $pages ) {
    return array(
        /* 'product', // Don't show Apple Pay and Google Pay on product pages */
        /* 'cart', */
        'checkout',
    );
}, 10, 1 );

Removing Square Google Pay from Certain Product Pages in WooCommerce

Analytics

Analytics Section Not Showing

Go to https://www.yoursite.com/wp-admin/options.php and look for the option woocommerce_analytics_enabled and change it to yes then click SAVE CHANGES.

Media Queries Screen Sizes List

/* Set the background color of body to tan */
body {
  background-color: tan;
}

/* On screens that are 992px or less, set the background color to blue */
@media screen and (max-width: 992px) {
  body {
    background-color: blue;
  }
}

/* On screens that are 600px or less, set the background color to olive */
@media screen and (max-width: 600px) {
  body {
    background-color: olive;
  }
}

CSS Media Queries - More Examples

This is a list of the known screen sizes so that you can customise your CSS for mobile devices.

For example, a Google Pixel...

@media screen 
  and (device-width: 360px) 
  and (device-height: 640px) 
  and (-webkit-device-pixel-ratio: 3) 
  and (orientation: portrait) {

}

https://css-tricks.com/snippets/css/media-queries-for-standard-devices/

Test Pages

Resize you browser window and watch the magic happen...

https://www.w3schools.com/cssref/tryit.asp?filename=trycss3_media_bg

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
  background-color: yellow;
}
@media only screen and (max-width: 600px) {
  body {
    background-color: lightblue;
  }
}
</style>
</head>
<body>
<h1>The @media Rule</h1>

Resize the browser window. When the width of this document is 600 pixels or less, the background-color is "lightblue", otherwise it is "yellow".

</body>
</html>

Menu Descriptions

https://www.wpbeginner.com/wp-themes/how-to-add-menu-descriptions-in-your-wordpress-themes/

Custom PHP Code

Paste the PHP code into your theme's file:

<?php 
echo do_shortcode('[smartslider3 slider=1]');
?>

Disable Avatars Gravatar

Every page load will try to contact gravatar.com to load a user's avatar. To speed things up, disable avatars...

Settings > Discussion > untick Show Avatars > Save Settings > Log Out

Make Twenty Nineteen Full Width

https://benjaminintal.com/2018/12/11/how-to-make-twenty-nineteens-content-full-width/

Responsive CSS Templates

https://www.w3schools.com/css/css_rwd_templates.asp

Simple One Page Theme

https://www.famethemes.com/themes/onepress/

https://raratheme.com/wordpress-themes/business-one-page/

https://demo.themegrill.com/flash-one-page/

https://www.inkthemesdemo.com/wptheme/free-one-page-wordpress-theme/

Nice Themes

Astra

Pysio

Google Fonts

Google Fonts Plugin

Host Google Fonts Locally

Security Scan

https://wpscans.com

FTP Details

NEWEST

FEBRUARY 2021 - FIX FOR FTP CHROOT

New tweak = put the chroot'd path to the base, content and plugin directories.

Also, use the 'ftpsockets' method.

/** FTP Tweaks */
define('FS_METHOD', 'ftpsockets');
define('FTP_SSL', 'false');
define('FTP_HOST', '123.456.789.0:21');
define('FTP_USER', 'username');
define('FTP_PASS', 'password');
define('FTP_BASE', '/html/');
define('FTP_CONTENT_DIR', '/html/wp-content/');
define('FTP_PLUGIN_DIR ', '/html/wp-content/plugins/');

NEWISH

/** FTP Tweaks */
define('FS_METHOD', 'ftpext');
define('FTP_HOST', 'ftp.example.org');
define('FTP_USER', 'username');
define('FTP_PASS', 'password');
define('FTP_BASE', '/path/to/wordpress/');

Full list of FTP variables...

define('FS_METHOD', 'ftpext');
define('FTP_BASE', '/path/to/wordpress/');
define('FTP_CONTENT_DIR', '/path/to/wordpress/wp-content/');
define('FTP_PLUGIN_DIR ', '/path/to/wordpress/wp-content/plugins/');
define('FTP_PUBKEY', '/home/username/.ssh/id_rsa.pub');
define('FTP_PRIKEY', '/home/username/.ssh/id_rsa');
define('FTP_USER', 'username');
define('FTP_PASS', 'password');
define('FTP_HOST', 'ftp.example.org');
define('FTP_SSL', false);

https://wordpress.org/support/article/editing-wp-config-php/

Version 5 Gutenberg Editor

https://wordpress.org/gutenberg/handbook/designers-developers/

About Page

https://www.domain.com/wp-admin/about.php

Hacking

WPscan - Open Source WordPress scanner

Attacking WordPress - /readme.html

Hack Check

11 Top Reasons Why WordPress Sites Get Hacked (and How to Prevent it)

How To Hack A WordPress Web Site

WordPress Releases

https://wordpress.org/download/releases/

WordPress Releases and PHP Requirements

PHP Compatibility and WordPress Versions

WordPress with Lighttpd

Installation

need to add

  • add php repo
  • add mysql repo
  • add extra php modules for new 'site health' (php7.3-bcmath, php-imagick)

https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions

sudo -i
apt-get install lighttpd php-cgi php-mysql mysql-server
lighty-enable-mod fastcgi
lighty-enable-mod fastcgi-php
wget -O wordpress-latest.tar.gz http://wordpress.org/latest.tar.gz
tar --strip-components=1 -xzvf wordpress-latest.tar.gz -C /var/www/domain.co.uk/html/
cd /var/www/domain.co.uk/html
mv wp-config-sample.php wp-config.php
chown -R ftpuser1:www-data .
find . -type f -exec chmod 664 {} +
find . -type d -exec chmod 775 {} +
chmod 660 wp-config.php

https://www.smashingmagazine.com/2014/05/proper-wordpress-filesystem-permissions-ownerships

FIXES THE RECENT WORDPRESS 5 BUG OF NOT SAVING PAGES

$HTTP["host"] =~ "domain.co.uk" {
  url.rewrite-if-not-file = (
  # Exclude directories
  "^/(wp-admin|wp-includes|wp-content|gallery2|.well-known)/(.*)" => "$0",
  # Exclude root php files
  "^/(.*.php)" => "$0",
  # Handle permalinks and feeds
  "^/(.*)$" => "/index.php/$1"
  )
}

WordPress with NginX

Docker WordPress with NginX and PHP-FPM

https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-ubuntu-20-04

https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-lemp-on-ubuntu-18-04

NOTES

sudo apt-get install nano
sudo apt-get install nginx
sudo apt-get install mysql-server
sudo mysql_secure_installation
sudo apt-get install php-fpm php-mysql
sudo apt-get install php-curl php-gd php-mbstring php-xml php-xmlrpc
sudo apt-get install curl

https://www.techrepublic.com/article/how-to-install-mcrypt-for-php-7-2/

Tuning Performance

HTTP/2 with nginX

https://mmoapi.com/post/tuning-nginx-php-fpm-and-system-sysctl-to-increase-website-performance

Sitemaps

# Rewrites for Yoast SEO XML Sitemap
rewrite ^/sitemap_index.xml$ /index.php?sitemap=1 last;
rewrite ^/([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;

https://yoast.com/help/xml-sitemaps-nginx/

Rest API Fix

This seems to be a NginX bug with the Gutenberg Editor and is part of the Tools > Site Health error "REST API is not working correctly."

Change all your lines with this...

try_files $uri $uri/ /index.php;

To this...

try_files $uri $uri/ /index.php$is_args$args;

Restart NginX and PHP FPM...

sudo systemctl restart php7.4-fpm.service nginx.service

https://developer.wordpress.org/rest-api/frequently-asked-questions/#query-parameters-are-not-working

Registration Page

/wp-login.php?action=register

Backup

https://managewp.com/features/backup

https://websitesetup.org/wordpress-backup/

WordPress Site Management

https://mainwp.com/features/

WordPress MultiSite

https://premium.wpmudev.org/blog/ultimate-guide-multisite/

Network Activate Plugins

On a WordPress multisite, only Super Admins can install plugins. After the installation, super admins have these options...

  1. Network Activate – Using this option super admins can activate a plugin across the network.
  2. Activate – They can also activate a plugin for the main/root site.
  3. Individual Sites – Lastly they can allow individual site administrators to activate plugins themselves.

When you log in to your WordPress multisite's main site, you will be able to see two different plugins screen.

The first one is on the main admin sidebar. It is for plugins installed and available for activation on your main site.

The second plugins screen is located under My Sites » Network Admin » Plugins. This is where you will install new plugins and manage them for the entire network.

https://www.wpbeginner.com/beginners-guide/should-you-network-activate-all-plugins-on-wordpress-multisite/

Add Plugins Menu for Child Sites in WordPress Multisite

To enable plugin’s menu for individual sites, you need to switch to Network Admin dashboard.

Switching to network admin dashboard

On the network admin dashboard, visit Settings » Network Settings. Scroll down to the bottom of the page and you will see the checkbox to enable plugins menu.

WP CLI

Show list of sites...

export WP_CLI_CACHE_DIR=/var/www/domain.co.uk/.wp-cli/cache; sudo -u www-data -E wp --path='/var/www/domain.co.uk/html/' site list

Show options for a multisite site...

export WP_CLI_CACHE_DIR=/var/www/domain.co.uk/.wp-cli/cache; sudo -u www-data -E wp --path='/var/www/domain.co.uk/html/' --url='http://mysubdomain.domain.co.uk/' option get siteurl

Change option for a multisite site...

export WP_CLI_CACHE_DIR=/var/www/domain.co.uk/.wp-cli/cache; sudo -u www-data -E wp --path='/var/www/domain.co.uk/html/' --url='http://mysubdomain.domain.co.uk/' option update siteurl 'http://mysubdomain.domain.com'

Help With Making Changes

https://www.siteground.com/kb/change-domain-wordpress-multisite/

Move Posts To Different Types

  • Posts to Pages
  • Pages to Posts
  • Default Post Type to Custom Post Type

http://wordpress.org/extend/plugins/post-type-switcher/

Custom Post Types and Categories and Taxonomies

https://www.wpbeginner.com/wp-tutorials/how-to-exportimport-custom-post-types-in-wordpress/

https://www.wpbeginner.com/wp-tutorials/how-to-add-categories-to-a-custom-post-type-in-wordpress/

Import Posts with Images

https://wordpress.org/plugins/export-featured-images/

https://kellenmace.com/include-featured-images-with-posts-using-wordpress-exportimport-tool/

https://wordpress.stackexchange.com/questions/257180/how-to-import-wordpress-posts-with-images-from-one-wordpress-site-to-another

DEBUGGING

The following code, inserted in your wp-config.php file, will log all errors, notices, and warnings to a file called debug.log in the wp-content directory.

It will also hide the errors so they do not interrupt page generation.

// Enable WP_DEBUG mode
define( 'WP_DEBUG', true );

// Enable Debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_LOG', true );

// Disable display of errors and warnings
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );

// Use dev versions of core JS and CSS files (only needed if you are modifying these core files)
define( 'SCRIPT_DEBUG', true );

NOTE: You must insert this BEFORE /* That's all, stop editing! Happy blogging. */ in the wp-config.php file.

Google Maps

https://www.embedgooglemap.net/

HOWTO: Create Folders Within Media Library

https://maxgalleria.com/add-organize-media-library-folders/

https://wordpress.org/plugins/media-library-plus/

HOWTO: Download Older Versions of WordPress Plugins

https://kinsta.com/knowledgebase/download-older-versions-of-wordpress-plugins/

HOWTO: Increase PHP Memory Limit (UpdraftPlus Error)

If you see this error when you use the wp cli ...

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate xxxxx bytes)

... then you can fix it by adding this to the wp-config.php file just before the "/* That's all, stop editing! Happy publishing. */" line:-

define('WP_MEMORY_LIMIT', '256M');

https://updraftplus.com/faqs/deal-fatal-error-allowed-memory-size-errors/

HOWTO: Disable wp-cron.php WP_CRON

WordPress uses a file called wp-cron.php as a virtual cron job, or scheduled task in order to automate things like publishing scheduled posts, checking for plugin or theme updates, sending email notifications and more.

By default WordPress is set up to call wp-cron.php every time someone visits your WordPress website when a scheduled task is present, to basically ask "is it time to do anything yet?".

On low traffic sites this is perfectly fine, but when visitors roll in, checking multiple times for scheduled tasks can be very inefficient and lead to resource usage problems for your server, plus make your website load slower.

To fix this, change the following setting in your wp-config.php file...

define('DISABLE_WP_CRON', true);

Then, create a cron job to call the script...

crontab -e
@hourly cd /var/www/website.co.uk/html/ && sudo -u www-data php wp-cron.php

or

@hourly curl --silent https://www.website.co.uk/wp-cron.php?doing_wp_cron

Thanks - https://www.inmotionhosting.com/support/website/wordpress/disabling-the-wp-cronphp-in-wordpress

HOWTO: Disable WordPress User Account

  • Method 1 - change the user's role to 'No Role For This Site'
  • Method 2 - install the Disable Users Plugin and disable that user.

Thanks - https://9seeds.com/how-to-disable-wordpress-user-accounts/

Hide Page Title On Home Page Only

body.home header.entry-header {
  display: none;
}

HOWTO: Hide Page Title Per Basis

style.css

.page-id-1826 .entry-title {display: none;}

Thanks - https://premium.wpmudev.org/blog/wordpress-hide-page-title-or-post-title-on-a-case-by-case-basis/

HOWTO: Download Latest Version

wget -O wordpress-latest.tar.gz http://wordpress.org/latest.tar.gz

HOWTO: Update Admin User Password Command Line

mysql -u root -p wordpress_database -e "UPDATE wp_users SET user_pass=MD5('MyNewPassword') WHERE ID='1';"

HOWTO: Extract WordPress Without First Directory

sudo tar --strip-components=1 -xzvf latest.tar.gz -C /path/to/directory/

e.g.

sudo tar --strip-components=1 -xzvf latest.tar.gz -C /var/www/domain.com/html/

HOWTO: Correct Ownership And Permissions Of BITNAMI Wordpress Files

sudo chown -R daemon:daemon /opt/bitnami/apps/wordpress/htdocs
sudo find /opt/bitnami/apps/wordpress/htdocs -type d -exec chmod 755 {} \;
sudo find /opt/bitnami/apps/wordpress/htdocs -type f -exec chmod 644 {} \;
sudo /opt/bitnami/ctlscript.sh restart apache
sudo /opt/bitnami/ctlscript.sh restart php-fpm

https://morganhvidt.com/fix-permissions-wordpress-bitnami-gcp/

HOWTO: Install Different PHP Modules on BITNAMI WordPress

Bitnami stacks already include a number of PHP modules, which are installed but not active. Before installing a new module, check that it is not already included. If it exists, simply enable it in the PHP configuration file.

Imagick

The Imagick module is installed in Bitnami stacks, but is not enabled by default. To enable it, follow these steps:

Uncomment or add the following line to the /opt/bitnami/php/etc/php.ini file:

...
extension=imagick.so
...

Restart the Apache server and/or the PHP-FPM service (if available):

sudo /opt/bitnami/ctlscript.sh restart apache
sudo /opt/bitnami/ctlscript.sh restart php-fpm

Thanks

HOWTO: Correct Ownership And Permissions Of Wordpress Files

You need to make the user the FTP login and the group the user Apache or Lighttpd runs as...

sudo chown -R fred:www-data /var/www/fred.com/html/

Change to the correct directory...

cd /var/www/fred.com/html/

For secure permissions...

sudo find . -type f -exec chmod 644 {} +
sudo find . -type d -exec chmod 755 {} +
sudo chmod 640 wp-config.php

For relaxed permissions...

sudo find . -type f -exec chmod 664 {} +
sudo find . -type d -exec chmod 775 {} +
sudo chmod 660 wp-config.php

HOWTO: Disable Update Check For A Single Plugin

Open the main plugin file and change the version number to 9.9.9

HOWTO: Create MySQL Database

  1. log in to mysql
  2. create database
  3. set user and password and permissions
  4. log out of mysql
mysql -u root -p
create database wordpress;
GRANT SELECT, INSERT, UPDATE ON wordpress.* to 'wordpressuser'@'localhost' identified by 'mypassword';
quit;

HOWTO: Generate Salt Keys

https://api.wordpress.org/secret-key/1.1/salt/

HOWTO: Complete Configuration

cd /var/www/domain.com/html
sudo rm -iv index.html
sudo mv -v wp-config-sample.php wp-config.php
sudo nano wp-config.php
define('DB_NAME', 'wordpressdatabase');
define('DB_USER', 'wordpressuser');
define('DB_PASSWORD', 'mYPassWOrd');
define('DB_HOST', 'localhost');
/** Authentication Unique Keys and Salts.
REPLACE LINES WITH YOUR LINES FROM SALT LINK ABOVE

Now load the web site in your web browser and complete installation.


HOWTO: Enable Updates Via SSH / SFTP

sudo aptitude install libssh2-php

Then, restart your web server software.

Thanks - https://snowulf.com/2010/06/29/wordpress-enabling-sshsftp-updates/

HOWTO: Update Via Command Line

WP CLI is a command line tool for managing your WordPress installation.

http://wp-cli.org

Install

NEW

sudo add-apt-repository ppa:tiagohillebrandt/wp-cli
sudo apt-get update
sudo apt-get -s install wp-cli
sudo apt-get -y install wp-cli
sudo -u www-data wp --info

OLD

For use with Docker containers...

curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
mv wp-cli.phar wp
chown root:root wp
chmod 0700 wp
./wp --allow-root --info
./wp --allow-root plugin deactivate --all
./wp --allow-root user list

IONOS Tweaks

Out of the box, the IONOS Linux hosting seems to use PHP 7.3 for wp-cli ...

wp cli info

To fix this, select your PHP version in the admin panel - e.g. 7.4

Log in to your hosting server using SSH, then check to make sure this test works ...

/usr/bin/php7.4-cli /usr/share/php/wp-cli/wp-cli-2.6.0.phar cli info

Then, assign a terminal shall alias to 'wp' for the second test and run 'wp' ...

alias wp='/usr/bin/php7.4-cli /usr/share/php/wp-cli/wp-cli-2.6.0.phar'
wp cli info

Then, create a few files to automatically load the alias and fix it ...

nano ~/.bash_profile
alias ll='ls -lah'
alias wp='/usr/bin/php7.4-cli /usr/share/php/wp-cli/wp-cli-2.6.0.phar'
nano ~/.bashrc
source ~/.bash_profile

Log out, then back in and type ...

wp cli info

... and it should now show the later version of PHP being used.

Commands

wp --info
wp core version
wp core check-update
wp core update
wp core update-db
wp core verify-checksums
wp theme update --all
wp plugin update --all
wp language core update
wp language theme --all update
wp language plugin --all update

Complete CLI Setup

#
# using wp command line tool to make a wordpress web site
# 

# create directories and log files
sudo mkdir -p /var/www/www.domain.co.uk/{html,logs,.wp-cli/cache}
sudo touch /var/www/www.domain.co.uk/logs/{access,error}.log
sudo chmod g+w /var/www/www.domain.co.uk/logs/{access,error}.log
sudo chown -R www-data:www-data /var/www/www.domain.co.uk/

# change to working directory
cd /var/www/www.domain.co.uk/html/

# create environment variables
export WP_CLI_CACHE_DIR=/var/www/www.domain.co.uk/.wp-cli/cache

# check wp cli working
sudo -u www-data -E wp --info

# download the core wordpress files
sudo -u www-data -E wp core download --locale=en_GB

# check the core wordpress files
sudo -u www-data -E wp core verify-checksums

# create a wordpress mysql database
sudo mysql -u root -p -e "CREATE DATABASE wwwdomaincouk; CREATE USER 'wwwdomaincouk' IDENTIFIED BY 'SuperPassword'; GRANT ALL ON wwwdomaincouk.* TO 'wwwdomaincouk'; FLUSH PRIVILEGES;"

# create a wordpress configuration file
sudo -u www-data -E wp core config --dbname='wwwdomaincouk' --dbuser='wwwdomaincouk' --dbpass='SuperPassword' --dbhost='localhost' --dbprefix='wp_'

# complete the installation process
sudo -u www-data -E wp core install --url='http://www.domain.co.uk' --title='Web Site Name' --admin_user='joe.bloggs' --admin_password='MyGoodPassword' --admin_email='me@domain.co.uk'

# check web site working on command line and admin dashboard works
curl -I http://www.domain.co.uk

# check for updates
sudo -u www-data -E wp core version
sudo -u www-data -E wp core update
sudo -u www-data -E wp core update-db
sudo -u www-data -E wp plugin list
sudo -u www-data -E wp plugin update --all
sudo -u www-data -E wp theme list
sudo -u www-data -E wp theme update --all
sudo -u www-data -E wp language core list --status=active
sudo -u www-data -E wp language core update
sudo -u www-data -E wp language plugin list --all --status=active
sudo -u www-data -E wp language plugin update --all
sudo -u www-data -E wp language theme list --all --status=active
sudo -u www-data -E wp language theme update --all

# add new user
sudo -u www-data -E wp user create john.doe john.doe@domain.co.uk --role=administrator --first_name=John --last_name=Doe --nickname=John --display_name=John

# list users
sudo -u www-data -E wp user list

As Another User On Server

cd /path/to/wordpress/
sudo -u www-data -E wp --help
sudo -u www-data -E wp core --help
sudo -u www-data -E wp core check-update
sudo -u www-data -E wp core download
sudo -u www-data -E wp core is-installed
sudo -u www-data -E wp core update
sudo -u www-data -E wp core update-db
sudo -u www-data -E wp core verify-checksums
sudo -u www-data -E wp core version
sudo -u www-data -E wp plugin --help
sudo -u www-data -E wp plugin list
sudo -u www-data -E wp plugin update
sudo -u www-data -E wp plugin update --all
sudo -u www-data -E wp plugin status
sudo -u www-data -E wp plugin activate --all
sudo -u www-data -E wp plugin status
sudo -u www-data -E wp theme --help
sudo -u www-data -E wp theme list
sudo -u www-data -E wp theme update --all
sudo -u www-data -E wp theme list
sudo -u www-data -E wp theme delete twentysixteen
sudo -u www-data -E wp theme delete twentyseventeen
sudo -u www-data -E wp theme list
sudo -u www-data -E wp theme search Intentionally
sudo -u www-data -E wp theme install intentionally-blank
sudo -u www-data -E wp theme activate intentionally-blank
sudo -u www-data -E wp language plugin --all update
sudo -u www-data -E wp language theme --all update
sudo -u www-data -E wp language core update

Config List Settings

wp config get

Config List File Location

wp config path

Database Show Tables Sizes

wp db size --tables

Database Optimise

wp db optimize

Database Repair

wp db repair

Database Export

wp db export

Database Export With Filename

wp db export ./filename.sql

Database Search

wp db query "SELECT * FROM wp_options"

Clear Cache

wp cache flush

Plugin Install

Install...

wp plugin install wordpress-seo

Install and activate...

wp plugin install wordpress-seo --activate

Install and activate a particular version...

wp plugin install wordpress-seo --version=4.8 --activate

Install and activate multiple plugins...

wp plugin install advanced-custom-fields jetpack --activate

Install and activate from your own location...

wp plugin install https://www.domain.com/path/to/my/myplugin.zip --activate

Plugin Deactivate

Deactivate...

wp plugin deactivate wordpress-seo

Deactivate all plugins (good for debugging a problem!)...

wp plugin deactivate --all

Plugin Update

Update...

wp plugin update wordpress-seo

Update all plugins...

wp plugin update --all

Site Blank

wp site empty

Site Blank and Delete Media Uploads

wp site empty --uploads
wp site empty --uploads --yes

Theme Child Create

wp scaffold child-theme NEW-CHILD-SLUG --parent_theme=SLUG --theme_name=TITLE

Help

https://www.codeinwp.com/blog/wp-cli/

Update Admin Email Address

wp option update admin_email 'me@domain.co.uk'
wp option update new_admin_email 'me@domain.co.uk'

User List

sudo -u www-data wp user list

User Create

wp user create <user-login> <user-email> [--role=<role>] [--user_pass=<password>] [--user_registered=<yyyy-mm-dd-hh-ii-ss>] [--display_name=<name>] [--user_nicename=<nice_name>]
[--user_url=<url>] [--nickname=<nickname>] [--first_name=<first_name>] [--last_name=<last_name>] [--description=<description>] [--rich_editing=<rich_editing>] [--send-email] [--porcelain]
sudo -u www-data wp user create joe.bloggs joe@bloggs.com --role=editor --display_name=Joe Bloggs --first_name=Joe --last_name=Bloggs

User Reset Password

1. Move into the /wordpress directory and type

sudo -u www-data wp user list

to see all users. Find the ID of the user you'd like to update.

2. Then, update the user

sudo -u www-data wp user update 1 --user_pass=changeme --skip-email

replacing "1" with the id of the user you want to update.

Check A Post For Type

sudo -u www-data wp post get 230

Show WordPress URL

wp option get home
wp option get siteurl

Change WordPress URL

wp option update home 'http://example.com'
wp option update siteurl 'http://example.com'

Search and Replace and View Changes

sudo -u www-data wp search-replace 'Lorem ' 'Lorum ' --dry-run --report-changed-only --log

Search and Replace WordPress Database Change URL

sudo -u wpusername wp search-replace 'http://test.domain.co.uk' 'http://www.domain.co.uk' --dry-run
sudo -u wpusername wp search-replace 'http://test.domain.co.uk' 'http://www.domain.co.uk'

or for auto SSL sites...

sudo -u wpusername wp search-replace 'http://test.domain.co.uk' 'https://www.domain.co.uk' --dry-run
sudo -u wpusername wp search-replace 'http://test.domain.co.uk' 'https://www.domain.co.uk'

Export All Users

This will export all users to a CSV...

sudo -u daemon -E wp --path=/opt/bitnami/apps/wordpress/htdocs/2 user list --format=csv >user_list.csv

Block A User

  1. change their password
  2. change their role
  3. change their email address
export WP_CLI_CACHE_DIR=/var/www/www.domain.co.uk/.wp-cli/cache/
sudo -u www-data wp --path=/var/www/www.domain.co.uk/html/ user list
sudo -u www-data wp --path=/var/www/www.domain.co.uk/html/ user update 2 --user_pass=iphoh3Qu --skip-email
sudo -u www-data wp --path=/var/www/www.domain.co.uk/html/ user update 2 --role= --skip-email
sudo -u www-data wp --path=/var/www/www.domain.co.uk/html/ user update 2 --user_email=different.email@domain.co.uk --skip-email
sudo -u www-data wp --path=/var/www/www.domain.co.uk/html/ user list

Delete All Subscribers

For this trick, you have to combine 2 commands in to 1... generate the list of users + feed that result to the delete command...

$ wp user delete $(wp user list --role=subscriber --field=ID) --reassign=2

Do the Export All Users first!

This is an example from a Bitnami WordPress install, using the user 'daemon' and the full path for completeness...

sudo -u daemon -E wp --path=/opt/bitnami/apps/wordpress/htdocs/2 user delete $(sudo -u daemon -E wp --path=/opt/bitnami/apps/wordpress/htdocs/2 user list --role=subscriber --field=ID) --reassign=23

Delete Comments

wp comment delete $(wp comment list --status=spam --format=ids) --force

or

wp comment delete $(wp comment list --format=ids) --force

Perform Commands Remotely

WP-CLI accepts an --ssh=[<scheme>][<user>@]<host>[:<port>][<path>] global parameter for running a command against a remote WordPress install.

First, install wp-cli on your computer...

sudo add-apt-repository ppa:tiagohillebrandt/wp-cli
sudo apt-get -y install wp-cli
sudo -u www-data wp --info

Then, use a host entry in your ~/.ssh/config file for your server, then you can run this...

wp --ssh=host --user=jbloggs --path='/var/www/domain.com/html' core version

https://make.wordpress.org/cli/handbook/guides/running-commands-remotely/

Migrate Copy Your Site

WP-CLI

https://rocketgeek.com/basics/using-wp-cli-to-migrate-copy-your-site/

All-in-One WP Migration

Fixed Old Version of All In One WP Migration 6.77 - use this to get around the paid for features...

  1. Install this version 6.77 of the plug-in on the staging host
  2. Create a backup on staging site
  3. Copy the wpress file to your new host
  4. Install this version 6.77 of the plug-in on the new host
  5. Create a quick backup to make the directory
  6. Move the wpress file to that directory (wp-content/ai1wm-backups/)
  7. Click on All-in-One WP Migration Backups
  8. Choose the file and click Restore :)

Convert to Multisite

wp core multisite-convert --subdomains
wp site list

https://developer.wordpress.org/cli/commands/core/multisite-convert/

https://developer.wordpress.org/cli/commands/site/

BackWPup

wp backwpup start <job-id>

https://backwpup.com/docs/starting-backup-job-immediately-or-scheduled/

Duplicate Post or Page

wp post create --from-post=123 --post_title='Different Title' --post_type=post
wp post create --from-post=321 --post_title='Another Title' --post_type=page

https://developer.wordpress.org/cli/commands/post/create/

HOWTO: CREATE: Child Themes

  • FTP in to site
  • Navigate to wp-content | themes
  • Create a new folder for the child theme, for example twentyfifteen-child (where twentyfifteen is the name of your parent theme)
  • Create a text file named style.css
  • Copy and paste the text from Example 1 below in to the style.css file.

Example 1:

/*
Theme Name: Example
Theme URI: http://example.co.uk
Description: Custom child theme
Author: Why me of course
Author URI: http://anotherexample.com
Template: theme-child
Version: 0.1
*/

@import url("../theme/style.css");
  • Next alter the text so it matches the details of the website the parent theme.

Example 2:

/*
Theme Name: twentyeleven-child
Theme URI: http://mywebsite.co.uk
Description: Custom child theme
Author: Fred Dibnah
Author URI: http://dibnah-inc.com
Template: twentyeleven 
Version: 0.1
*/

@import url("../twentyeleven/style.css");
  • FTP style.css to wp-content | themes | twentyfifteen-child
  • In the WordPress control panel navigate to Appearance | Themes

HOWTO: REMOVE: Comment Box From An Existing Page

  • All Pages
  • Select the 'Quick Edit' option
  • Un-tick 'Allow Comments'

HOWTO: ALTER: Site URL

There are various methods to change the Site URL manually. Any of these methods will work and perform much the same function.

1. Edit wp-config.php

It is possible to set the site URL manually in the wp-config.php file.

Add these two lines to your wp-config.php, where "example.com" is the correct location of your site.

define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');

2. MySQL

Edit home and siteurl from the wp_options table using PHPMyAdmin or similar.

3. wp Command Line

A. You can use the official WP command line tool to alter the 'home', 'siteurl' options.

cd /path/to/wordpress/files
sudo -u user wp option get home
sudo -u user wp option get siteurl
sudo -u user wp option update home 'http://www.domain.co.uk'
sudo -u user wp option update siteurl 'http://www.domain.co.uk'

https://developer.wordpress.org/cli/commands/option/

B. You can also use the command line to alter every part of the MySQL Database.

cd /path/to/wordpress/files
sudo -u user wp search-replace 'http://test.domain.co.uk' 'http://www.domain.co.uk' --dry-run
sudo -u user wp search-replace 'http://test.domain.co.uk' 'http://www.domain.co.uk'

https://developer.wordpress.org/cli/commands/search-replace/

HOWTO: htaccess Extra Security Tweaks

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# extra security tweaks
RewriteRule ^wp-admin/includes/ - [F,L]
RewriteRule !^wp-includes/ - [S=3]
RewriteRule ^wp-includes/[^/]+\.php$ - [F,L]
RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L]
RewriteRule ^wp-includes/theme-compat/ - [F,L]
</IfModule>

http://wordpress.org/download/

HOWTO: Disable All Plugins Via PHPMyAdmin Or MySQL

mysql> update wp_options set option_value = "a:0:{}" where option_name = 'active_plugins';

Thanks to - http://www.webhostinghero.com/manually-disable-wordpress-plugins/

HOWTO: WordPress Security

Plugins

  1. WordFence
  2. reCAPTCHA
  3. Health Check
  4. Hide My WP WordPress and How to set up Hide my WP for Bitnami Servers

Wordfence

Hands down, the best.

NEW - Wordfence Command Line!

Wordfence CLI

Setup

Download ...

cd /root/docker/
git clone https://github.com/wordfence/wordfence-cli.git
cd wordfence-cli/

Configure ...

docker run -v $(pwd):/root wordfence-cli:latest configure --configuration /root/.config/wordfence/wordfence-cli.ini --overwrite --default --accept-terms --request-license

Check ...

$ cat .config/wordfence/wordfence-cli.ini
[DEFAULT]
cache_directory = ~/.cache/wordfence
license = 115e4a467b330ad5302cf1a50723f268e122a948d0e53f47d2417deeeea614xxxxxxxxxxxxxxxxxxxxxxx
[MALWARE_SCAN]
workers = 1

docker run -v $(pwd):/root wordfence-cli:latest version
Wordfence CLI 5.0.1
PCRE Supported: Yes - PCRE Version: 8.39 2016-06-14 (JIT Supported: Yes)
Vectorscan Supported: No

Documentation ...

https://github.com/wordfence/wordfence-cli/blob/main/docs/Configuration.md

Usage

Password Protect Admin Folder Dashboard

https://www.wpbeginner.com/wp-tutorials/how-to-password-protect-your-wordpress-admin-wp-admin-directory/

Tutorials

Secure Your WordPress Website

Secure WordPress Theme

The Ultimate WordPress Security Guide

Security Updates Mailing List

http://www.wordfence.com/subscribe-to-the-wordfence-email-list/

HOWTO: WordPress Core: Add Page Last Modified Date

Add this code to your footer.php file...

Last modified: <?php the_modified_date(); ?>

http://codex.wordpress.org/Template_Tags/the_modified_date

HOWTO: WP-Members: Remove Powered By Link In Footer

Edit the file...

wp-content/plugins/wp-members/wp-members-dialogs.php

Search for 'powered by' and comment out both lines.

HOWTO: Deactivate all plugins when unable to access the administrative menus?

  • Via FTP or your host's file manager, navigate to the wp-contents folder (directory)
  • Via FTP or your host's file manager, rename the folder "plugins" to "plugins.hold"
  • Login to your WordPress administration menus (/wp-admin)
  • Via FTP or your host's file manager, rename "plugins.hold" back to "plugins"

http://codex.wordpress.org/FAQ_Troubleshooting

DukaPress Shop Plugin

TO BE DONE.

HOWTO: SET: The Home Page As A Static Page Instead Of Post

  • Create a new page, it does not have to be called home.
  • Settings --> Reading --> Front page displays --> change from 'Your latest posts' to 'A static page (select below) and use the drop down menu to set the page required.
  • Click 'Save Changes'.
  • Optional: If you still want a 'Posts page' posts that option is also allowed for.

HOWTO: SET: Menus As A Non-Clickable Top Level Item

This method only applies if you are using the default menu provided in WordPress.

First off do not create a page for the non-clickable as there is no need.

  • WP Menu --> Appearance --> Menus
  • Links widget (under Pages in the left hand widget)
  • In the URL box change the contents 'http://' to '#' (without the quotes)
  • Add a label
  • Click the 'Add to Menu' button
  • Click the 'Save Menu' button

WorldPay

TO BE DONE.

Test Credit Card Numbers - http://www.worldpay.com/support/kb/bg/testandgolive/tgl5103.html

HOWTO: Permalinks (Page URL) - Alter

Go to:

Control Panel --> Settings --> Permalinks

Select 'Post name'

Finally click the 'Save Changes' button.

Or the more complicated method:

Add this to your .htaccess file...

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Mobile Skin

http://wordpress.org/extend/plugins/wptouch/

HOWTO: REMOVE: 'Home' Button

The code you need to modify is located in the TwentyTen Theme's functions.php file.

$args['show_home'] = false;

PLUGIN: Yoast SEO

Use wp-cli

wp yoast index

Indexing posts  100% [==============================] 0:00 / 0:00
Indexing terms  100% [==============================] 0:00 / 0:00
Indexing post type archives  100% [=================] 0:00 / 0:00
Indexing general objects  100% [====================] 0:00 / 0:00

To reset the index database, use this command ...

 wp yoast index --reindex

https://developer.yoast.com/features/wp-cli/reindex-indexables/

Fix Incorrect URL On Breadcrumbs Links After Site Move

  1. Install the Yoast Test Helper plugin, found here https://wordpress.org/plugins/yoast-test-helper/
  2. Go to Tools → Yoast Test
  3. Click the Reset Indexables tables and Migrations button
  4. Go to SEO → Tools
  5. Click the Start SEO Optimisation button and let it complete

https://wordpress.org/support/topic/after-the-change-of-domain-breadcrumbs-link-partly-still-old-url/

How To Hide Breadcrumbs On Home Page

body.home #breadcrumbs {
  display: none;
}

Useful Links

Github Filters

Custom Filters

Don't Show Home on Breadcrumbs

PLUGIN: Coming Soon and Maintenance Mode

https://en-gb.wordpress.org/plugins/coming-soon/

PLUGIN: All-In-One WP Migration

Size Limit Fix

/wp-content/plugins/all-in-one-wp-migration/constants.php
// =================
// = Max File Size =
// =================
define( 'AI1WM_MAX_FILE_SIZE', 536870912 * 8 );

PLUGINS: Caching

https://www.elegantthemes.com/blog/resources/the-best-wordpress-cache-plugins-and-how-to-use-them

HOWTO: FIX:

Error: Undefined index: HTTP_X_FORWARDED_PROTO with WP-CLI

Change the lines in your wp-config.php to these ...

define('FORCE_SSL_ADMIN', true);
define('FORCE_SSL_LOGIN', true);
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'){ $_SERVER['HTTPS']='on'; }

https://randomadult.com/fix-undefined-index-http_x_forwarded_proto-with-wp-cli/

Missing Appearance Menus in Dashboard

https://www.wpbeginner.com/beginners-guide/how-to-fix-missing-appearance-menu-in-wordpress-admin/

Error: Minified React error #31

This seems to be a NginX bug with the Gutenberg Editor and is part of the Tools > Site Health error "REST API is not working correctly."

Change all your lines with this...

try_files $uri $uri/ /index.php;

To this...

try_files $uri $uri/ /index.php$is_args$args;

Restart NginX and PHP FPM...

sudo systemctl restart php7.4-fpm.service nginx.service

https://developer.wordpress.org/rest-api/frequently-asked-questions/#query-parameters-are-not-working

Error: Sorry, you are not allowed to edit posts in this post type

This is probably because it is a post type of revision...

sudo -u www-data wp post get 449
...
post_name             | 230-revision-v1
post_type             | revision

Error: changeset_post_save_failure

This is caused by a faulty PHP file in the WordPress installation and a possible MySQL database corruption.

Use wp command line to backup the database, then clear the database, then force upgrade the WP install.

sudo -i
sudo -u www-data -E wp db export wp_db_export_file.sql
chown www-data:www-data wp_db_export_file.sql
cp -av wp_db_export_file.sql ~/
cp -av wp-config.php ~/
sudo -u www-data -E wp db reset --yes
service mysql restart
sudo -u www-data -E wp db import wp_db_export_file.sql
sudo -u www-data -E wp db check
sudo -u www-data -E wp db tables
sudo -u www-data -E wp core update --force --locale=en_GB
sudo -u www-data -E wp core update-db
sudo -u www-data -E wp core verify-checksums --locale=en_GB

Error: Wordfence Update Error

If you see this error when updating Wordfence in the WordPress Dashboard...

Installing Plugin: Wordfence Security x.x.x
Downloading install package from https://downloads.wordpress.org/plugin/wordfence.x.x.x.zip…
Unpacking the package…
Could not copy file. wordfence/xxxxx/xxxxxx

You need to go to /wp-content/upgrade/ and delete all the wordfence folders/files in there. Chances are you won't be able to do that via FTP due to chown problems but will need shell access to your server to get rid of them. After that is done you will be able to upgrade without a problem.

cd /home/user/www/wp-content/
sudo rm -rfv upgrade/*

Thanks - https://wordpress.org/support/topic/update-error-v-517

Wordfence Central

Head over to Wordfence Central, go to the Connection Issues tab. Clear out any sites that might be in here.

Now go back to your site and log in as an admin. Navigate to Tools > Diagnostics > Other Tests > Clear all Wordfence Central connection data. Clear the connection data, which it looks like you already tried, then from the Wordfence Dashboard, click on “Connect this site” in the Wordfence Central widget.

https://www.wordfence.com/help/central/connect/#troubleshooting-connection-issues also has some troubleshooting steps you could follow.

Lighttpd Permalinks

$HTTP["host"] =~ "www\.domain\.uk\.com$" {
server.document-root = "/home/lighttpd/www.domain.uk.com/html"
server.errorlog = "/home/lighttpd/www.domain.uk.com/logs/error.log"
accesslog.filename = "/home/lighttpd/www.domain.uk.com/logs/access.log"
url.rewrite-if-not-file = ( "^/(wp-.+).*/?" => "$0", "^/keyword/([A-Za-z_0-9\-]+)/?$" => "/index.php?keyword=$1", "^/.*?(\?.*)?$" => "/index.php$1" )
}

Thanks - http://antesarkkinen.com/blog/wordpress-with-lighttpd-pretty-url-permalinks-and-jetpack/

Error: PCLZIP_ERR_BAD_FORMAT

Installing Plugin: Disable Author Pages 0.7
Downloading install package from https://downloads.wordpress.org/plugin/disable-author-pages.zip…
Unpacking the package…
The package could not be installed. PCLZIP_ERR_BAD_FORMAT (-10) : Unable to find End of Central Dir Record signature

WP E-Commerce and Gold Cart Plugin

To reinstall for the new version...

  1. Go here - http://getshopped.org/extend/premium-upgrades-files/
  2. Put in API Key and then you can download (as of writing) version 2.9.3 of the gold cart.
  3. Unpack the /gold_cart_files/ folder to your hard disk
  4. FTP in and upload that whole folder to /public_html/wp-content/plugins
  5. Log in to the WP Admin Panel
  6. Go to Plugins and Activate the plugin
  7. Go to the Dashboard section and click on Store Upgrades
  8. Fill in your Name and API Key to activate the plugin
  9. Go to the Store > Presentations section to change drop-down View to Grid View

Updates On Hosting With 1&1

The problem I was having was the update would start, and then just stop after a few seconds.

Then in my wp-content folder I would see a bunch of failed downloads. They were the update zip files with a 0 byte size.

The Solution:

Add the following line to your .htaccess file in the root directory of your blog.

AddType x-mapp-php5 .php

This will enable PHP version 5 + on your blog and then your update should take off.

http://www.big-webmaster.com/wordpress-automatic-update-with-1and1/

White Screen of Death

https://wpmayor.com/what-to-do-when-a-wordpress-plugin-causes-your-website-to-crash/