I’ve been blogging on WordPress for several years now and every so often I come across a way to make working on the platform a little bit easier. In fact, here’s a piece of advice: If you find yourself frustrated, do a quick Google search for your issue and there’s a good chance someone out there has faced the same problem as you and has found a solution or workaround!
WordPress Hacks
Today I’m sharing 10 WordPress hacks that have helped me in one way or another over the years! Hopefully at least one of them will help you work faster and more productively. Let’s get started!
1. Get your navigation links to open in a new tab
External links that open in the same tab are one of my biggest pet peeves when it comes to top menu navigation bars. It baffles me that so many bloggers are sending traffic away from their blogs to other sites! A general rule of thumb when it comes to links is that if the link is internal (pointing to another page on your site), it should open in the same tab, but when the link is external (pointing to another website), it should open in a new tab. Things like social media links should always open in a new tab, so people can continue reading your blog after they follow you on a social network!
Getting your links to open in a new tab is easier than you might think.
Go to Appearances and then click Menu. At the top right, click Screen Options.
From there, you’ll see a section called “Show advanced menu properties” and within it, a box called “Link Target.” Check that box. You can close the Screen Options by clicking it again.
Now when you scroll down to your links and expand the option for one, below the “Navigation Label” you’ll see a check box to “Open link in a new tab.” Check that box on each link you want to open in a new tab!
2. Change the Default Image Alignment & Size in WordPress
This one has saved me a ton of time! After months of manually setting the image size, link and alignment for each picture I uploaded, I finally discovered a way to set these options automatically!
Go to your functions.php file within your Theme Editor.
If you don’t know how to get there, then try: Appearance > Editor > select the functions.php link under Theme Files or navigate to: https://yoursite.com/wp-admin/theme-editor.php?file=functions.php
Then add the following code at the bottom:
1
2
3
4
5
6
7 /* Image Alignment, Link Type, Size Settings */
function attachment_default_settings() {
update_option('image_default_align', 'center' );
update_option('image_default_link_type', 'blank' );
update_option('image_default_size', 'large' );
}
add_action('after_setup_theme', 'attachment_default_settings');
Here are the options for each line:
- Image alignment: left, right, center, none
- Image linking: custom, post, file, none
- Image size: thumbnail, medium, large
Hit Update File and you’re done!
3. Change the Default Post Category
Did you know that you can set or change the default post category when you create a new blog post? If the majority of your blog posts get assigned to a specific category, then this feature could be really useful and save you some time each time you create a new post.
Even if you don’t post in one main category, this can be useful. I personally always hated the “Uncategorized” category and wanted to delete it! But, the only way to delete a blog post category is if it’s not assigned as the default.
Go to Settings > Writing and select your Default Post Category from the list provided!
4. Stop WordPress from Creating Multiple Image Sizes
Every time you upload a new image, depending on your theme, WordPress will create multiple sizes of that same image! This translates to a LOT of unnecessary disk space used on your storage server. If you know that you don’t need certain image sizes, then tell WordPress to stop creating copies.
You can do this within your WordPress dashboard by going to the Settings > Media > Media Settings and then take a look at the Image Sizes section. You’ll see the all the default image sizes there, and you can change the width and height to 0 and 0 for those you don’t need.
Keep in mind, this only affects future image uploads, and not previous ones!
5. Set image file title as alt text
This is one of my favorite WordPress hacks. Want to save yourself some time when writing image descriptions? Have WordPress assign the image file name as your alt text when uploading! Just remember to rename your image files before uploading them to WordPress.
To enable this hack, edit your functions.php file and add the following code at the bottom:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 /* Automatically set the image Title, Alt-Text, Caption & Description upon upload
--------------------------------------------------------------------------------------*/
add_action( 'add_attachment', 'my_set_image_meta_upon_image_upload' );
function my_set_image_meta_upon_image_upload( $post_ID ) {
// Check if uploaded file is an image, else do nothing
if ( wp_attachment_is_image( $post_ID ) ) {
$my_image_title = get_post( $post_ID )->post_title;
// Sanitize the title: remove hyphens, underscores & extra spaces:
$my_image_title = preg_replace( '%\s*[-_\s]+\s*%', ' ', $my_image_title );
// Sanitize the title: capitalize the first letter of every word (other letters lower case):
$my_image_title = ucwords( strtolower( $my_image_title ) );
// Create an array with the image meta (Title, Caption, Description) to be updated
// Note: comment out the Excerpt/Caption or Content/Description lines if not needed
$my_image_meta = array(
'ID' => $post_ID, // Specify the image (ID) to be updated
'post_title' => $my_image_title, // Set image Title to sanitized title
'post_excerpt' => $my_image_title, // Set image Caption (Excerpt) to sanitized title
'post_content' => $my_image_title, // Set image Description (Content) to sanitized title
);
// Set the image Alt-Text
update_post_meta( $post_ID, '_wp_attachment_image_alt', $my_image_title );
// Set the image meta (e.g. Title, Excerpt, Content)
wp_update_post( $my_image_meta );
}
}
6. Link to a specific section of a blog post
Ever wanted to link to a specific section of your blog post, further down? Simply add the following as the link itself:
1 #section
And be sure to add the following code just above where you want the link to go within the HTML of your blogpost itself:
1 <div id="section"></div>
7. Use “Text Expander” add-on to save snippets of text you write often
I am in LOVE with the Text Expander add-on for Google Chrome which lets me type out long snippets of text that I write very often.
The way this add-on works is every time you type a short combination of letters, a longer amount of text is automatically typed out for you. So for example, I have the text ;h3 automatically converted to
1 <h3></h3>
and ;w convert to
1 blogambitious.com
Those are just a few examples of the shortcuts you can create with this truly awesome, time-saving add-on!
8. Create a Table of Contents in longer posts
If you write long posts (over 1,000 words) then you may want to make it easier for readers to navigate them using a Table of Contents. Of course, creating a table of contents for each post on your blog would be a really tedious task! This plugin will automatically find the breaks in your posts and insert a handy table of contents at the beginning of your posts.
If you use an ad network or make money with in-content ads, then I don’t recommend adding a table of contents, as you could loose out on ad revenue by helping users skip the bulk of your content.
9. Display Images in Columns (use “Create Gallery” or a Columns plugin if you want the images linked externally)
Since I work on a laptop, I hate when bloggers have long lists of huge images! I feel like I have to scroll to see the entire image. I started to put my own images in columns (one beside the other) to help break up this monotony.
I use the Column Shortcodes plugin to do this, and it’s made all the difference in my posts!
10. Prevent RSS readers like Bloglovin from copying your entire post
I chose to disable entire posts being available in my RSS feed so that people actually have to click to visit my blog and I am consequently paid for their page views through advertising. Platforms like Bloglovin and other RSS readers have no qualms about using your RSS feed to pull your entire post onto THEIR website, keeping their users on their websites longer. This doesn’t really benefit you, so it’s best to disable entire posts in your RSS feed. That way the beginning sentence appears under the blog title, giving potential readers a taste of the article, but in the end, they have to actually click through to your blog to read the entire thing!
To disable entire posts in your RSS feed, go to Settings > Reading > Summary
I hope this article on WordPress hacks and tips has helped you learn a little bit more about your WordPress website and has increased your productivity! Happy blogging!
Hi, Thanks for the great article. However, I am having an error with the code on number 5 (Set image file title as alt text)
Hi! Sorry about that. It looks like the plugin is adding “pre” and “code” tags before and after the code. So just remove those tags!
Using good image compression plugin, database optimization plugin,caching plugin and seo plugin etc are good optimization for wordpress. This will boost overall and save time and rank on Google as well.