QUICK TIP - WordPress tricks – The most useful tricks you should know

0 1,236,174
:2of8
1
2
3
4
5
6
7
8
Most Useful .htaccess Tricks for WordPress | A&H Business Technology
Related posts

Upon successful execution of the above command, all data associated with post revisions will be removed the database. This includes the post revisions themselves and all the meta data associated with each revision.

Credit: Andrei Neculau

Reduce Comment Spam by Blocking No-Referrer Requests 

As explained in my article, denying access to no-referrer requests, you can greatly reduce the number of spam comments by eliminating all direct requests for your blog’s comments-post.php file. This will block automated spam scripts from bypassing your comments form by hitting the comment processing script directly. Here are two ways to block no-referrer comment requests, one uses HTAccess and the other uses PHP. Here is the HTAccess method:

Place that code in your site’s root HTAccess file and edit the domain.tld to match your own domain. Once in place, this code will redirect any request for your blog’s comments-post.php file that didn’t originate from your site back to the URL from whence it came.

This may also be accomplished via PHP. Place the following function in your theme’s functions.php file:

Source: AH Business Technology

Prevent Google Analytics from Tracking Admin Pages 

This handy snippet will prevent Google Analytics from tracking your Admin pages or anything else that you wish. Replace your default Google Analytics code with the following:

This code will then include your Google Analytics code only on non-Admin pages. This in turn will prevent Google Analytics from gathering statistics about your Admin pages. Note that the basic functionality of this method is great for restricting just about anything — scripts, markup, content — to logged-in administrators.

Meta Descriptions without a Plugin 

We don’t need no stinkin’ plugin for custom meta descriptions. All you need is a custom field named metadescription with the desired meta description for each post. Once you have that going, include the following function to your theme’s header.php file (within the <head> section:

This function enables you to customize the descriptions for various types of pages, such as the home page, category pages, tag archives, and so on. For single post-view pages, this function will display the value of the metadescription custom field.

Differentiate Between Posts Depending on Presence of Excerpt 

Here is a quick conditional snippet that displays different content depending on the presence of an excerpt:

Placed inside the loop, this code will check each post for an excerpt. If one is found, the excerpt is displayed; otherwise, the code specified in the else condition is displayed.

Modify the wp_options Table via the WordPress Admin 

As you probably know, the wp_options table stores a great deal of useful information, including everything from custom-field values, plugin settings, blog information, and much more. If any table in the WordPress database needs its own friendly user-interface, this would be it.

TinyURL for this post: https://tinyurl.com/y3vlpp3o

Sorry, The Comment Form Is Temporarily Closed At This Time
:2of8
1
2
3
4
5
6
7
8
2
Next
You may also like

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

Language:English