Getting Started With Postgres: Three Free and Easy Ways

Hello, fellow developers! This year, approximately 90,000 of us participated in the Stack Overflow survey. Impressively, we crowned Postgres as the #1 database. Moreover, DB Engines also spotlights PostgreSQL as one of the fastest-growing databases worldwide. What does this mean for us?

It's clear that we should strive to become PostgreSQL experts. An essential step in this direction is setting up our own database for hands-on experiments. 

How To Easily Secure Your WordPress Site for Free

It goes without saying — WordPress security is vital. The importance of having a secure site can’t be understated if you want to be protected against malware, avoid being hacked, and stay high-ranking on Google.

The good news is that there are easy steps you can take to secure your WordPress site — for free!

If your site isn’t secure or gets hacked, information, such as passwords and personal information is vulnerable. Hackers can steal user info and use it for malicious purposes.

Plus, your site can lose its good reputation. If your site is not secure and becomes vulnerable, you can get blocklisted by Google, and your ranking could even take a nosedive in the SERPs. Yuck!

This article explores the top cost-saving measures you can implement to stop hackers in their tracks, keep bots aways, and stay ranking high on Google.

We’ll look at how to boost security from the WordPress admin and also with the help of our free security plugin, Defender.

defender with free security.
Defender is pretty stoked about free security!

Here’s what I’ll be covering:

  1. Quick and Easy Ways to Secure Your Site in the WordPress Admin
  2. Keeping Your Site Secure by Noticing Outdated Plugins and Themes
  3. Creating Secure and Strong Passwords
  4. Some Other Security Tweaks to Consider in the Admin
  5. Securing Your Site for Free with Defender

By the time you read this, you’ll have plenty of ways to keep your WordPress site secure for free.

So, put your wallet away. You won’t be needing it here.

1. Quick and Easy Ways to Secure Your Site in the WordPress Admin

We’ll start with some essentials to avoid any unfortunate security issues. Some of these precautions may be obvious to you, but they’re worth mentioning.

An Updated WordPress is a Secure WordPress

One of the most important precautions you can take is to keep your WordPress, plugins, and theme updated.

Where the WordPress updates are in the admin.
Where you can see all of the updates needed in the WordPress dashboard. The number in the red circle indicates the number of updates available.

WordPress is regularly installing updates to keep things current. On top of that, themes and plugins frequently are updated and maintained.

If themes and plugins are not maintained properly, they’ll become outdated and a security risk by becoming vulnerable to bugs. It’s essential to keep all of these elements of WordPress up to date.

WordPress makes all of this quick and easy to do. By clicking on the Updates tab in the dashboard, you’ll see a detailed look at what needs updating.

Plus, you can enable automatic updates for all new versions of WordPress from here, so you don’t even need to worry about doing it manually.

The WordPress updates.
You can see the current version of WordPress and the option of enabling automatic updates.

Keeping tabs on your WordPress version, themes, and plugins is a crucial part of keeping your site secure. It doesn’t cost a dime to do, and is easy to maintain.

Good news if you’re a WPMU DEV member… all plugins, themes, and WordPress files automatically update with our Automate feature (which comes free with The Hub) — so you’re already taken care of!

2. Keeping Your Site Secure by Noticing Outdated Plugins and Themes

It’s important to point out that you don’t want to use any outdated plugins or themes to begin with. Fortunately, WordPress gives notification for plugins and themes that haven’t been updated.

For example, if you are searching for a plugin on wordpress.org and see this towards the top of the plugin’s page…

The message for an outdated plugin in WordPress.
A sure sign that this plugin is not maintained well.

…you’ll want to avoid that plugin. Similarly, an outdated theme will display the same type of message.

The sign of an outdated theme.
Two years is a long time to go with no update.

Avoid any plugins or themes that aren’t updated to begin with.

Chances are, the developers who created them have abandoned it, and it will not be updated soon.

If you do find that you have outdated themes and plugins, delete them. Even if they’re not in use, they’re not worth having around and are susceptible to bugs.

3. Creating Secure and Strong Passwords

One of the most frequent hacking attempts is with passwords. So it’s becoming more common these days with any online account to use a strong password, and the same is true with WordPress.

Make your passwords unique, with characters, numbers, and letter combinations that would be extremely difficult ever to replicate. You should do this with your FTP accounts, hosting, email, and database as well.

WordPress will automatically create a strong password for you in the admin. You can choose to create your own or use their suggestion.

The WordPress generated password.
A new password is easily created by going to User > Profile > Set New Password.

Plus, don’t give your account information to anyone and grant them access (I think we all know better, but still, I had to mention it…). You can set up users and roles in WordPress for others, but keep your passwords private.

Also, change your passwords regularly. It’s suggested that every 30-days or so is a good time frame for generating a new password.

4. Some Other Security Tweaks to Consider in the WordPress Admin

You can take a few other free security precautions when it comes to WordPress.

Logging out of your account when not in use, deleting spammy comments, and limiting roles for other users are some other easy ways to stay secure.

Beyond the admin, you’ll see that there’s a ton that can be accomplished with the help of a plugin when it comes to beefing up your security.

5. Securing Your Site for Free with Defender

The majority of security precautions you can implement for free can be handled easily with our very own plugin, Defender.

Defender can stop brute force attacks, SQL injections, cross-site scripting XSS, and tons more like malware & antivirus scans, IP blocking, security log, and two-factor authentication login security.

An image of Defender.
Defender is here to help!

When it comes to a free security solution, Defender is a perfect option to keep your site safe and secure! Plus, it’s all easily manageable as he makes security a breeze.

Here’s a breakdown of what Defender can do to stop any hackers or bots that are up to no good.

Security Tweaks

Defender mentions security recommendations you can make to improve site security, like disabling XML-RPC, hide error reporting, disabling trackbacks & pingbacks, and more.

Many of the recommendations can be handled in one-click and bulk by way of the Security Recommendations area.

Defender's security recommendations.
All of the tweaks are suggested in the Security Recommendations area.

It’s suggested to take care of all of the recommended security tweaks; however, some might not be practical for your WordPress site.

If you ever need to revert a tweak, you can do so with the Revert option.

You can get a detailed look at all of the recommended tweaks in the drop-down menu.

There, you’ll be able to see an overview of the vulnerability, status, how to fix, an option to ignore, and also an action button that’s unique to the suggested fix.

For more information, be sure to check out this detailed look at security tweaks with Defender.

Security Scans

Malware Scanning is a great resource for keeping your site protected. It checks your WordPress core files for suspicious code.

This tool compares your WordPress install with the master copy in the WordPress directory, reports any changes, and enables you to restore the original file in a click.

New Defender scan.
Start a new scan in one click or have one scheduled.

The scan results are viewed directly on Defender’s dashboard. You can get a detailed look at the results under View Report, showing the suggested fixes for each issue.

From there, you can take care of them in bulk.

Take care of all of your issues in bulk.

You can also create a new scan in one-click and get notified of reports via email — even if no issues are found.

Malware scanning and taking care of security issues has never been easier. Get an inside look at one-click malware scanning in Defender.

2-Factor Authentication

Make the accounts for you and your users even more secure with 2-factor authentication.

With Defender, you can choose the user roles you want to enable 2-factor authentication in one-click from the dashboard.

2fa users and roles.
Select as many user roles as you want for 2-factor authentication.

You’re also able to enable a Lost Phone feature if a user can’t access their mobile device.

Additionally, customize the App Title that appears in the Authenticator app, view active users, and customize the email copy for two-factor authentication emails.

Plus, you can choose what app to use for 2FA. You can pick between Google Authenticator, Microsoft Authenticator, and Authy.

Two-factor authentication is an excellent line of defense against hackers and a welcome added layer of protection.

Read more about Defender’s 2FA here.

Firewall, 404 Detection, and IP Management

Your WordPress site is safely protected with Defender’s firewall and IP management. With it, you can manually block specific IPs, set automated timed & permanent lockouts, import a list of banned IPs, and more.

Firewall in Defender.
Defender tells you all of the lockouts your site has had in the past 24 hours and more — right in the dashboard.

Defender will lock out users after a specified set number of failed login attempts. You’re able to customize the amount of failed logins and timeframe of the lockout.

Plus, you can customize the lockout message.

Defender image showing lockout.
Defender will let the culprit know what’s up.

Also, enable 404 Detection, which will keep an eye out of IP addresses that are repeat offenders trying to access a web page that doesn’t exist.

It will then temporarily block them from accessing your WordPress site.

Like with the failed logins, you can add a customized message and choose the duration of time for the lockout. Additionally, you can add files, folders, and file types you want to ban automatically.

As for the IP banning, you choose which IP addresses you want to ban from accessing your WordPress site in a Blocklist.

Likewise, you can choose any IPs you want to exempt from any ban rules in the Allowlist.

Other IP management features include:

  • The ability to view active lockouts
  • Option to ban countries you don’t want traffic from
  • Customized lockout message users will see
  • Import and export of blocklist and allowlist

Not only that, Defender logs all IP lockouts with detailed information, time, and date of occurrence.

From there, you can click on the dropdown of individual occurrences and instantly ban the IP or add it to the allowlist.

Want this IP added to the blocklist? Do so in one-click.

Firewall and IP management will keep your site in check from any suspicious IPs looking to cause havoc. For more, be sure to read our article, How to Create a Powerful and Secure Customized Firewall with Defender.

Login Protection

Quickly limit login attempts to stop users from trying to guess passwords. It’s easy with Defender’s Login Protection.

With this, you can also permanently ban IPs or trigger a timed lockout after a set amount of failed attempted logins.

This feature is under the Firewall category in the dashboard. Choose the threshold of how many attempted failed logins the user has and the amount of time for the lockout.

The login protection area in Defender.
In this example, it’s set at five failed logins within 300 seconds for a lockout. The lockout will remain for 300 seconds.

You can add a customized message that explains the lockout. Also, add banned usernames by adding them in the system.

For more on Login Protection, check out this article.

Login Screen Masking

To prevent hackers and bots from discovering your login screen, you can change your default URL.

With login screen masking, you’ll add a new URL slug to login from. And you can redirect traffic to any visitor or bot that tries to visit the default WordPress login.

Where you choose a new slug.
Choose any new slug that you’d like.

This is a great way to prevent hackers and bots from even getting close to your login area. Just like any villain, if they can’t find the door, there’s not much chance of them getting in.

WordPress Security is Priceless

As you can see, there is a lot you can do to secure your WordPress site for free! You don’t need to spend your hard-earned cash on security — especially with the help of our plugin, Defender.

It takes time and dedication to implement what we discussed. The more you devote to your WordPress security, the harder it is for hackers and bots to take advantage of your site and cause chaos.

Plus, your site won’t get blocklisted by Google and maintain its good reputation.

On that note, for an overview of Defender’s security features, check out this quick video.

And for more on security, be sure to read our Ultimate Guide to WordPress Security and Getting the Most Out of Defender.

Also, in the name of #SecurityMonth you can currently get 35% off your first year of our Security & Backups Pack featuring Defender Pro, Snapshot Pro, Shipper Pro, and Automate. Use the coupon below to unlock the exclusive deal.

35% Off Security & Backups Pack

Take advantage of these free resources and sleep well, knowing you’ve stepped up your security game to keep your site safe.

Writing Testable Code

No, not this kind of test.

This has become my favorite subject because it turns out that testability, above nearly every other metric, is important to strive for in developing software. And all other code qualities seem to be a reflection of testability.

5 Easy Ways to Write Hard-to-Test Code

When I say testable code, what I mean is code that can be verified programmatically and in a very granular way. When a test fails, we want it to tell us exactly why so that we know what went wrong and can correct the problem immediately. This means that we're verifying very small units of behavior. This not only helps us debug code when there are problems, but it also helps keep us focused on building software that fulfills some desired behavior.

4 Easy Ways to Re-Order Blog Posts in WordPress (Step by Step)

Do you want to change the order of your blog posts in WordPress?

By default, WordPress displays your blog posts in reverse chronological order (newer posts first), but sometimes you may need to move specific posts up or down.

While it may feel like there is no way to do this in WordPress, you’ll be surprised to learn how easily you can change post order using multiple ways.

In this article, we will show you 4 different ways to re-order blog posts in WordPress. You can pick a solution that looks easier and fits your needs.

Ways to easily re-order blog posts in WordPress

Why Re-order Blog Posts in WordPress?

If you are just starting a blog, then you will not need to re-order your blog posts right away. However as your content grows, you may want to explore different ways to promote content across your website.

One of them is to make specific posts more prominently displayed on the front page, blog page, recent posts, or archive pages.

Now the problem is that WordPress normally displays your blog posts in a reverse chronological order. There is no option to simply just move a post up and down.

Does this mean you cannot bring your older articles to the front page? Or remove a newer article from the recent posts?

No, not at all.

There are multiple workarounds that let you do just that. Depending on your needs, you can choose the method that suits your requirements.

Let’s take a look at some of the ways you can easily re-order blog posts on your WordPress site.

1. Change Post’s Published Date

This is the easiest method and allows you to re-order posts using the built-in WordPress functionality.

As you know that WordPress displays posts based on their publish date in reverse chronological order (newer posts first). Changing a post’s publish date will also change where it appears in the list.

Reorder posts by changing published date

For example, if you wanted to bring an older post up, you would have to change its date to be newer. Similarly if you wanted to move a post down, then you can change its date to be older.

Simply edit the post you want to reorder and on the post edit screen click on the publish date under the Document panel.

Change publish date for a blog post

This will bring up a date and time popup where you can change the post’s published date and time. After you have changed the date/time, click on the ‘Update’ button to save your changes.

You need to select a date relevant to other posts.

For example, if you wanted to display an older post before another post that was published on 8 March, then you need to change the post’s publish date to 9 March.

Post moved up

2. Use Post Types Order Plugin (Drag and Drop Option)

If you want to re-order posts but don’t want to change their publish dates, then this method is for you.

First, you need to install and activate the Post Types Order plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, you need to visit Settings » Post Types Order page to change plugin’s settings.

Post Types Order settings

From here, you need to select the post types where you want to enable the plugin. After that, simply click on the ‘Save settings’ button to store your changes.

Now you can just go to Posts » All Posts page and simply drag and drop posts to re-order them.

Reorder blog posts by drag and drop

3. Use Sticky Posts Feature in WordPress

Many users just want to reorder blog posts to highlight a blog post as featured content. WordPress comes with a default feature to achieve that, and it’s called Sticky posts.

Sticky posts feature allows you to highlight a post on top of all other posts on your blog page.

Simply edit the blog post that you want to pin to the top. On the post edit screen, check the box next to ‘Stick to the Front Page’ option under ‘Document’ panel.

Make a post sticky in WordPress

After that, click on the ‘Update’ button to save your changes.

You can now visit your website, and you will see the selected post pinned to the top. Depending on your theme, your sticky post will be highlighted differently.

Sticky post highlighted in WordPress

4. Modify WordPress Query using Code (Advanced)

This method requires you to add code to your WordPress site. If you haven’t done this before, then see our guide on how to copy and paste the code in WordPress.

If you are an advanced user and want to customize the post order, then you can modify the default WordPress query.

For example, take a look at this code snippet. It allows you to display posts in chronological order (older posts first).

//function to modify default WordPress query
function wpb_custom_query( $query ) {

// Make sure we only modify the main query on the homepage	
	if( $query->is_main_query() && ! is_admin() && $query->is_home() ) {

 	 	// Set parameters to modify the query
 		$query->set( 'orderby', 'date' );
		$query->set( 'order', 'DESC' );
	}
}

// Hook our custom query function to the pre_get_posts 
add_action( 'pre_get_posts', 'wpb_custom_query' );

This code simply modifies the orderby and order parameters in the default WordPress query.

However, this code may sometimes not work as expected due to some plugins or theme already modifying the default query. To fix that, you can use the supress_filters parameter like this:

//function to modify default WordPress query
function wpb_custom_query( $query ) {

// Make sure we only modify the main query on the homepage	
	if( $query->is_main_query() && ! is_admin() && $query->is_home() ) {

 	 	// Set parameters to modify the query
 		$query->set( 'orderby', 'date' );
		$query->set( 'order', 'DESC' );
		$query->set( 'suppress_filters', 'true' );
	}
}

// Hook our custom query function to the pre_get_posts 
add_action( 'pre_get_posts', 'wpb_custom_query' );

The oderby parameter comes with many options. See the full list of options on the WP Query codex page.

We hope this article helped you learn easy ways to re-order blog posts in WordPress. You may also want to see our ultimate list of most wanted WordPress tips and tricks that you can use on your blog.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post 4 Easy Ways to Re-Order Blog Posts in WordPress (Step by Step) appeared first on WPBeginner.

How to Remove Author Name from WordPress Posts (2 Easy Ways)

Do you want to remove the author name from your WordPress blog posts? Normally, blog posts are supposed to show author name with other meta-data like date and category.

However, some blog owners may not want to display the author name next to their blog posts.

By default, WordPress does not have an option to remove author name, and you must select an author to publish a post.

In this article, we will show you two ways to easily remove author name from your WordPress posts. We will also discuss the pros and cons of each approach.

Remove author name from WordPress posts

Why Would You Want to Remove Author Name?

Author name is an important type of metadata added to your WordPress posts by default. It allows your readers to learn about authors who create content on your blog.

However, there are times when you may want to hide the author name.

For example: if multiple staff members in your team collaborate on each blog post, then it may seem unfair to credit a single staff member for the work.

In another scenario, you may have several contributors/freelance writers who occasionally write articles, but you want to keep a consistent style and voice for your blog.

With that said, let’s take a look at solutions for easily removing author name from WordPress posts while still allowing multiple authors to work in the background.

Method 1: Manually Remove Author Name from WordPress Posts

Your WordPress theme decides when and how to display the author name in your blog posts. Themes use multiple approaches to do that which makes it harder for a plugin to provide a generic solution for removing author names.

You will need to edit some code to prevent your theme from displaying the author name. If you are uncomfortable editing code, then try the second method instead.

The first method requires you to edit WordPress theme files. If you haven’t done this before, then please take a look at our guide on how to copy and paste the code in WordPress.

Note: Make sure that you create backup of your theme or child theme before making any changes. If something goes wrong, then this will help you easily revert changes.

WordPress themes use different variations of code to display the author name. You will need to locate the code responsible for showing the author’s name in your theme files and delete it.

Most common locations to find this code are single.php, content.php, archive.php, and index.php files.

In many cases, you will not be able to find the code that outputs author name. Instead, you will find a template tag defined in the functions.php file or template-tags.php file.

For example, the default Twenty Nineteen theme uses the function twentynineteen_posted_by to display author name. This function is defined in template-tags.php file and uses the following code:

function twentynineteen_posted_by() {
		printf(
			/* translators: 1: SVG icon. 2: post author, only visible to screen readers. 3: author link. */
			'<span class="byline">%1$s<span class="screen-reader-text">%2$s</span><span class="author vcard"><a class="url fn n" href="%3$s">%4$s</a></span></span>',
			twentynineteen_get_icon_svg( 'person', 16 ),
			__( 'Posted by', 'twentynineteen' ),
			esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
			esc_html( get_the_author() )
		);
	}
endif;

Once you have located the code that outputs the author name, you need to delete it.

For example, you have to delete the code from the second line to the ninth line in the above code. After that, the remaining code will look like below.

function twentynineteen_posted_by() {
}
endif;

Don’t forget to save your changes after deleting the author name code. Then, upload the files back to your website.

You can now visit your website to see your changes in action:

Author Name Removed in WordPress Post Demo

This method hides the author name on all your posts; however, the author archive pages will remain intact. An author archive page is where WordPress creates a list of all articles written by a specific user.

You can find author archive page on a URL like this:

https://example.com/author/samsmith/

This URL is discoverable by search engines, which means you may still get traffic to those pages.

You can disable the author archives easily using the Yoast SEO plugin. Once you install and activate the plugin, go to SEO » Search Appearance your dashboard and then click the ‘Archives’ tab.

Now you can see the author archive settings. You can toggle Author Archives switch and disable author archives on your site.

Yoast SEO Author Archive Settings

Doing so will disable author archives and hide author-sitemap.xml file created by the Yoast SEO plugin.

Method 2: Create a Generic Author Name for Publishing WordPress Posts

This method does not remove the author name, but it can be used as a workaround.

You will create a generic author name and use it for all your past and future articles. You will need to change the author name before publishing each post.

Note: This method is irreversible. If you do this and want to revert, then you will have to edit each post and assign it to the original author manually.

That being said, let’s get started.

First add a new author to your WordPress site and give it a generic username such as editorialteam.

Add new user

Next, you need to visit Users » All Users page and click on the ‘Edit’ link below the username you just added.

Edit user

On the user profile screen, scroll down to the ‘Nickname’ option and enter the name you want to be displayed (for example, Editorial Team).

After that, click on the drop down menu next to ‘Display name publicly as’ option and select the nickname you just entered.

Select display name

You can also add a generic bio and even create a gravatar for that user account.

Now go to Posts » All Posts page and click on the screen options menu at the top. Enter 999 for number of items to display.

Show all posts on screen

This will allow you to quickly edit and change author name for a large number of posts.

You need to select all posts using the checkbox and then select edit under the bulk actions drop down menu. After that click on the ‘Apply’ button to continue.

Select all posts for bulk editing

WordPress will now show you the bulk editing options. You need to change the author to the generic author name you added earlier and then click on the Update button.

Bulk change author name

WordPress will now update all selected posts and change author name. Remember, this process may take some time depending on how fast your WordPress hosting is.

If you have more than 999 posts, then you will need to go to page 2 and repeat the process.

That’s all. You can now visit your website to see it in action.

Editorial Team as Author Name

Our Recommendation

Removing author name using the coding method gets the job done, but it is not the best solution. For example, if you are not using a child theme, then a theme update will override your changes.

This is why we recommend the second method to create a generic author name.

Doing so allows you to use the built-in WordPress functionality and does not require you to edit any code. It will not remove author name or archives but will make them generic. It will also help to ensure consistency of authorship on your site.

If you are good with coding, then you can also use a combination of both approaches. You can create a generic author name to publish all your blog posts, and then hard-code author profile in a WordPress child-theme.

We use a similar approach at WPBeginner. You can see ‘Editorial Staff’ as the author for all blog posts including this one you are reading right now.

Generic Author Name on WPBeginner Article

You can also see that in the author info box at the bottom of the article.

Generic Author Info Box in WPBeginner Article

If you want to add an author info box like this, then take a look at the best free author bio box plugins.

We hope this article helped you learn how to remove author name from WordPress posts. You may also want to see our list of 30 effective ways to monetize your website.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Remove Author Name from WordPress Posts (2 Easy Ways) appeared first on WPBeginner.