Thursday, February 2, 2023
  • Events
  • Interviews
  • Jobs
  • Opinion
  • Whitepapers
  • Glossary
  • Community Forum
  • Web Hosting Directory
  • Login
  • Register
Cloud7 News
  • Cloud Computing
  • Web Hosting
  • Data Center
  • Linux
  • Cybersecurity
  • More
    • Network/Internet
    • Windows
    • Software
    • Hardware
    • Blockchain
    • Policy/Legislation
    • How-Tos
    • Troubleshooting
No Result
View All Result
Cloud7 News
  • Cloud Computing
  • Web Hosting
  • Data Center
  • Linux
  • Cybersecurity
  • More
    • Network/Internet
    • Windows
    • Software
    • Hardware
    • Blockchain
    • Policy/Legislation
    • How-Tos
    • Troubleshooting
No Result
View All Result
Cloud7 News
No Result
View All Result

Home > Software > Weekly tips & tricks: WordPress #2

Weekly tips & tricks: WordPress #2

This week we are delivering some useful WordPress tips and tricks in WordPress development and security.


Rusen Gobel Rusen Gobel
March 12, 2022
4 min read
Weekly tips & tricks WordPress

WordPress is the most popular CMSwebsite development platform. Although the developers are adding new features and security fixes frequently, WordPress always has room for more improvements. You can use the following tips and tricks to achieve the design goals and make your website more secure.

Table of Contents

  • Usage of webhooks
  • Creating a child theme
  • Changing the /wp-admin/ path
  • Database optimization
  • Backing up in WordPress
  • Delete the unnecessary files that load on every page
  • Use Query Monitor

Usage of webhooks

The hooks are one of the most used functions to develop plugins, create themes, and solve problems. You can run additional code lines before, right off, or after an event using webhooks. This enables users to run the necessary tasks without touching WordPress core files. You can use the webhooks by following the steps below:

add_action(string $hook_name, callable $callback, int $priority = 10, int $accepted_args = 1);

Parameters

  • $hook_name (string) (Required) The name of the action to add the callback to. 
  • $callback (callable) (Required) The callback runs when the action is called. 
  • $priority (int) (Optional) Used to specify the order in which the functions associated with a particular action are executed. Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order they were added to the action. Default value: 10 
  • $accepted_args (int) (Optional) The number of arguments the function accepts. Default value: 1

The $hook_name and $callback from the parameters above are required, but the other two are optional.


Creating a child theme

The developers of WordPress mostly need to make some changes in the themes. As you shape the theme with additional codes, your changes disappear as you update the theme; it rewrites the files you have changed or added new lines of codes. Using child theme prevents this unpleasant situation. That’s why we advise you to create a child theme before making changes to the theme itself.

How to create a child theme?

If the theme you are using has no option to create a child theme automatically, you can do it by yourself. Just go to /wp-content/themes/ in FTP and create a new folder with the same name but with adding -child to the end (e.g. /wp-content/themes/XXX-child). You can also copy the screenshot.png file from the original folder to create a thumbnail in the WordPress themes interface. Then, follow the steps below:

  • Create a new file named functions.php in the child theme folder
  • Copy the following codes into the functions.php files by changing the cloud7 phrases with your theme and child theme folders:

    add_action( 'wp_enqueue_scripts', 'c7_theme_enqueue_styles' );
    function c7_theme_enqueue_styles() {
      wp_enqueue_style( 'cloud7', get_template_directory_uri() . '/style.css' );
      wp_enqueue_style( 'cloud7-child', get_stylesheet_uri());
    }
  • Create a new file named style.css in the child theme folder
  • Edit and copy the following codes into the style.css file. Be careful while renaming the Template line; you need to put the original theme folder’s name and it is case sensitive:

    /*  
    Theme Name: Cloud7 Child
    Description: This theme child file is created by Cloud7.
    Author: Cloud7 Team
    Author URI: https://cloud7.news/
    Template: cloud7
    Version: 1.0
    Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
    */
  • Activate your child theme from the Themes interface in WordPress.

Changing the /wp-admin/ path

One of the most important security measures for WordPress is changing the default admin path. By doing that, you can avoid some attacking techniques such as brute force and SQL injection. You can change the admin path by installing and using the following plugins:

WPS Hide Login

All In One WP Security & Firewall


Database optimization

You should be aware of the sizes of the databases in your WordPress websites since they might become unmanageable as they grow. One of the main reasons for it is rapidly installing, trying, and deleting plugins. Do not try the plugins in the live websites, but in a demo environment. Trying plugins might also cause some security risks.


Backing up in WordPress

You might find yourself in very unpleasant situations by accidentally deleting some necessary files. Even worse, a hacker might use a zero-day attack to delete all of the files in your files on the website. If you are not backing up your website, it will likely ruin your day, or maybe a month, or even a year. Use the following plugin to backup your website regularly. It is advised to back up the files in third-party applications such as cloud services.

Updraft Plus WordPress Backup


Delete the unnecessary files that load on every page

The files of your theme and plugins are being loaded on all of the pages of your website. This situation drastically affects the performance of your website. You can prevent this by using Asset CleanUp: Page Speed Booster plugin by Gabe Livan. It enables admins to disable some .js and .css from selected pages. And that will improve the performance.

Asset CleanUp: Page Speed Booster


Use Query Monitor

Query Monitor is an open-source WordPress debugging plugin. It is quite handy while debugging database queries, PHP errors, hooks and actions, enqueued scripts and styles, theme template files, languages and translations, rewrite rules, block editor blocks, and HTTP API calls errors.

Query Monitor

See more Software News


Tags: WordPress
Rusen Gobel

Rusen Gobel

Rusen Gobel is a news editor at Cloud7 News. With more than 10 years of experience, Rusen worked as a hardware and software news editor for technology sites such as Shiftdelete, Teknokolis, Hardware Plus, BT Haber. In addition, Rusen publishes consumer product reviews on his YouTube channel. While consumer electronics has been his main focus for years, now Rusen is more interested in WordPress and software development. He had contributed different web application projects in his professional career. Rusen had graduated from Istanbul University, department of Computer Engineering. Rusen has a very high passion for learning and writing for every kind of technology. That's why he has been working as a tech editor for more than ten years on several different technology magazines and online news portals.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

I agree to the Terms & Conditions and Privacy Policy.

Next Post
Weekly round-up 7 - 12 March

Weekly round-up: 7-12 March

Related News

OPNsense 23.1 released

OPNsense 23.1 released, download now

January 31, 2023 3:15 pm
GIMP developers pushing hard to release version 3.0 in 2023

GIMP developers pushing hard to release version 3.0 in 2023

January 31, 2023 2:45 pm
ChatGPT is available now as an extension for Linux

ChatGPT extension for Linux available now

January 23, 2023 5:25 pm
VirtualBox 7.0.6 comes with initial support for Linux 6.2

VirtualBox 7.0.6 comes with initial support for Linux 6.2

January 19, 2023 3:30 pm
Get free daily newsletters from Cloud7 News Get the Cloud7 Newsletter
Select list(s):

Check your inbox or spam folder to confirm your subscription.

By subscribing, you agree to our
Copyright Policy and Privacy Policy

Get the free newsletter

Subscribe to receive the latest IT business updates straight to your inbox.

Select list(s):

Check your inbox or spam folder to confirm your subscription.

Editor's Choice

What’s new in Linux kernel 6.2 rc6?

10 Best Web Hosting Services of 2023

Ubuntu 22.04 LTS is available for download. What is new?

CERN and Fermilab recommend AlmaLinux

7 best hosting control panels of 2023

How to update Linux Kernel without rebooting?

7 best Linux mail servers of 2023

7 best cPanel alternatives for 2023

7 best Linux web browsers for 2023

7 best CentOS alternatives

7 best Linux server distros of 2023

Interview with Igor Seletskiy on AlmaLinux

How to create a VM on VMware Workstation

Recent News

  • Gcore introduces per-minute billing for video streaming
  • APTs are looking for developers to hire with hefty paychecks
  • F5 reports first quarter financial results
  • US extradites ShinyHunters hacker
  • Hacker steals code signing certificates for GitHub Desktop and Atom

Cloud7 News
Cloud7 is a news source that publishes the latest news, reviews, comparisons, opinions, and exclusive interviews to help tech users of high-experience levels in the IT industry.

EXPLORE

  • Web Hosting
  • Cloud Computing
  • Data Center
  • Cybersecurity
  • Linux
  • Network/Internet
  • Software
  • Hardware
  • How-Tos
  • Troubleshooting

RESOURCES

  • Events
  • Interviews
  • Jobs
  • Opinion
  • Whitepapers
  • Glossary
  • Community Forum
  • Web Hosting Directory

Get the Cloud7 Newsletter

Get FREE daily newsletters from Cloud7 delivering the latest news and reviews.

  • About
  • Privacy & Policy
  • Copyright Policy
  • Contact

© 2023, Cloud7 News. All rights reserved.

No Result
View All Result
  • Cloud Computing
  • Web Hosting
  • Data Center
  • Linux
  • Cybersecurity
  • More
    • Network/Internet
    • Windows
    • Software
    • Hardware
    • Blockchain
    • Policy/Legislation
    • How-Tos
    • Troubleshooting
  • Events
  • Interviews
  • Jobs
  • Opinion
  • Whitepapers
  • Glossary
  • Community Forum
  • Web Hosting Directory

© 2023, Cloud7 News. All rights reserved.

Welcome Back!

Sign In with Facebook
Sign In with Google
Sign In with Linked In
OR

Login to your account below

Forgotten Password? Sign Up

Create New Account!

Sign Up with Facebook
Sign Up with Google
Sign Up with Linked In
OR

Fill the forms below to register

*By registering into our website, you agree to the Terms & Conditions and Privacy Policy.
All fields are required. Log In

Retrieve your password

Please enter your username or email address to reset your password.

Log In
This website uses cookies. By continuing to use this website you are giving consent to cookies being used. Visit our Privacy and Cookie Policy.