Connect with us


9 Useful WordPress Hook Hacks



WordPress has established itself as a potential CMS (Content Mangemnet System) over the years. Many of the globally popular websites like Sony Music, BBC America, TechCrunchetc are running on the CMS. The extenet of its effectiveness and popularity can be understood from the fact that around 40% of the websites that are active today are running of the CMS. The open source and free avialabiity adds further to its popularity.

Many firms nowadays don’t look to develop their CMS. Rather they think why not look here to top full stack WordPress developer to get things done. WordPress developers are kept busy thanks to the demand and popularity of the platform. However, you not always have to look for a developer to make your website attractive using the WordPress. Yes, you can do manythings on your own as well.

What Are Hook Hacks?

What we are talking here are hook hacks. Hook is basically a method to make changes in the working of WordPress through changes in it’s core files. Since the changes in the core files are involved there are chance of creation of security loopholes thus, the hooks are less recommended. However, you can bring such changes through hook hacks. Wondering how, well that’s what the main thing that we are going to discuss it out here.

Auto Formatting 

Auto formatting is by default available in the WordPress. It makes certain formatting changes to the content when the post gets displayed. If you want to display some specific kind of content say  program code then it can be annoying.

To remove this issue all you need is copying the below given code in functions.php file:

functionmy_formatter($content) {

  $new_content = ’;

  $pattern_full = ‘{([raw].*?[/raw])}is’;

  $pattern_contents = ‘{[raw](.*?)[/raw]}is’;

  $pieces = preg_split($pattern_full, $content, -1, PREG_SPLIT_DELIM_CAPTURE);


  foreach ($pieces as $piece) {

    if (preg_match($pattern_contents, $piece, $matches)) {

      $new_content .= $matches[1];

    } else {

      $new_content .=ptexturize(wpautop($piece));



  return $new_content;


remove_filter(‘the_content’, ‘wpautop’);

remove_filter(‘the_content’, ‘wptexturize’);

add_filter(‘the_content’, ‘my_formatter’, 99);

Google Analytics 

Installing Google Anlaytics is important for the SEO and web traffic assessment on your website. The effective way to do is through the third party plug-in. This would help you in avoiding coding hassles as they are based on customized needs of different kinds of websites.

Controlling Login  

By default the WordPress allows you unlimited login attempts to the website. This can be kind of exposes the website to encroachment of cyber attacks. To limit these attempts you need a plug in called the Login LockDown to set the limit.

Comment Notification 

Comments of visitors on websites is a good thing not only for SEO but for the creditibility of your website as a source as well. To better connect this feature with users you should provide them notification when some new comment is received on their comment. This is commonly done through e-mail notifications. You have to install the Subscribe to Comments plugin and activate it in the settings to get the feature rolling.

Categories To Pages 

The default mechanism of the CMS allows adding tags and categories to each specific post and not the webpages. The reason is that web pages are considered as static content.

However, you can add categories to the pages as well. Just go to the site-specific plugin or file named functions.phpan copy this code:


// add tag and category support to pages

functiontags_categories_support_all() {

  register_taxonomy_for_object_type(‘post_tag’, ‘page’);

  register_taxonomy_for_object_type(‘category’, ‘page’);  



// ensure all tags and categories are included in queries

functiontags_categories_support_query($wp_query) {

  if ($wp_query->get(‘tag’)) $wp_query->set(‘post_type’, ‘any’);

  if ($wp_query->get(‘category_name’)) $wp_query->set(‘post_type’, ‘any’);



// tag and category hooks

add_action(‘init’, ‘tags_categories_support_all’);

add_action(‘pre_get_posts’, ‘tags_categories_support_query’);


Breaking of Code Snippet 

The WordPress software converts the quotes entered as normal text into smart codes. Due to this this their develops a risk of breaking the code snippet that is required to be published. You can avoid this by copying another snippet in the  functions.php file. The snippet that we are talking about is:

remove_filter (‘the_content’, ‘wptexturize’)

Enhancing Memory

Have you seen memory exhausted error when you install a big plug in file? If yes then do you know you can enhance the memory in WordPress? Yes, it is possible to do by copying the code:


define(‘WP_MEMORY_LIMIT’, ‘64M’);

In the wp-config.php file.


Stop Auto Saving 

WordPress has a system of storing posts automatically after a specific period of time. Though this is a useful thing sometimes you want to avoid that. Well, its easy to do that. To disable auto saving go to functions.phpand copy this code:




add_action( ‘wp_print_scripts’, ‘disableAutoSave’ );


Delay RSS Feeds

It happens quite often that we publish a post that is meant to be posted sometime later. Though we can delete the post and reschdule the RSS feed readers and your e-mail surbvcirbers would get that post in their box. This can disturb your website’s reputation and thus is a serious issue. Don’t worry as you can delay the going of a post to the feeds after its publishing by as much as 10 minutes.

Just go to the functions.php file of the theme and copy the code:


global $wpdb;

if ( is_feed() ) {

// timestamp in WP-format

$now = gmdate(‘Y-m-d H:i:s’);


// value for wait; + device

$wait = ’10’; // integer




// add SQL-sytax to default $where

$where .= ” AND TIMESTAMPDIFF($device, $wpdb->posts.post_date_gmt, ‘$now’) > $wait “;


return $where;


add_filter(‘posts_where’, ‘publish_later_on_feed’);

Hi. I am Muhammad Mubeen Hassan. I am SEO Expat and Wordpress Websites Developer &  Blogger. 30 years old. I help entrepreneurs become go-to in their industry. And, I like helping the next one in line. You can follow my journey on my blog, for list Click Here If you need any post so you can email me on my this Email:  

Continue Reading
1 Comment

1 Comment

  1. Muhammad Mubeen Hassan

    November 2, 2021 at 10:42 am

    This is due to the fact that this program is simple to install, flexible and enriched with high-performance features and is extremely flexible Clientica. Amazing, right? This is the reason why lots of people rely on this tool.

You must be logged in to post a comment Login

Leave a Reply


How to Choose the Perfect Logo for Your Business



When you making the decision for a logo design, you have to keep a few things in your mind that will help to give the identity to your business. If you want a creative logo for your business, try to get some logo inspiration and check the successful company’s logo, how they create a logo related to their company or business. You also arrange a logo design contest where so many professional logo designers give their vision and concept for your brand. And you can take the help of a logo design tool.

Visual Representation: A good logo and its visual representation create a very good impression in the minds of the people.

Unique concept: A unique logo concept will create a very good impression of your business.

Memorability Factor: We know that people remember a product or business by the logo rather than the brand name. The advantage of this when you are thinking of launching a new logo or sub-product, you can create a new logo by just adding the new name in the present logo. By doing this you create brand awareness of your new product amongst your customers.


Creating or designing a unique logo for your company can be very challenging. There are so many professional logo designers for creating a very unique logo or you can also try logo designer service.

So, the overall logo is very important for your company and it is really difficult to create a very impressive logo for your company.

Continue Reading


%d bloggers like this: