Remove short words from wordpress permalink URL

WordPress itself creates the permalink. WordPress permalinks are very important for SEO purpose. Short words are sometimes are not good for seo so you might need to remove the short words from permalink. Using the following code you can remove the short words from wordpress permalink URL.

Using code you can Remove short words from wordpress permalink.

You just need to add the following code functions.php file.

add_filter('sanitize_title', 'remove_short_words');
function remove_short_words($slug) {
 if (!is_admin()) return $slug;
 $slug = explode('-', $slug);
 foreach ($slug as $k => $word) {
 if (strlen($word) < 3) {
 unset($slug[$k]);
 }
 }
 return implode('-', $slug);
}

 

Source Link :wpsnipp.com

 

change wordpress permalink to post name without losing traffic

Earlier I used date and name permalink structure for my blogs. Recently I got information about SEO URL tricks and I made decision to change permalink structure to Post name.  Here we shown how to change wordpress permalink to post name without losing traffic.  redirect to 404. interlinked other posts. They will go to 404 page.

change wordpress permalink to post name without losing traffic

change wordpress permalink to post name without losing traffic
change wordpress permalink to post name without losing traffic

So I changed permalink from:

https://purabtech.in/%year%/%monthnum%/%day%/%postname%/

to:

https://purabtech.in/%postname%/

It was very simple to above changes through wp admin->settings->permalink.

But with this produced many issues. Like google search result will go to old site URLs and My blog links are posted on other multiple blogs. That links will be broken and redirect to 404. Also I interlinked my other posts with other posts. They will go to 404 page.

If your blog pages will not found then google site ranking will go down.

By default in wordpress links look like /index.php?p=1234 which are not very useful for visitors or search engines.

In this walkthrough we’ll guide you through changing that to something useful like /post-title/.

Here I will tell you without loosing trafic or SEO how can you change the wordpress permalink day and name to post name

First go to wp admin->settings->permalink section and change setting to post name

If you are using any caching plugin (w3-cache or wp super chache) then remove all cache from dashboard.

Last edit .htaccess file and put following code there. Change domain name to your site name.

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RedirectMatch permanent ^/[0-9]{4}/[0-9]{2}/[0-9]{2}/([a-z0-9-/]+) http://digcms.com/$1
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

When would you want to use the other permalink settings?

  • If you’re a news site, the Day and name or Month and name option lets visitors know when the content was published.
  • Google News requires you to have a minimum of 3 numbers in your article URLs. The date-based options achieve this.
  • If you have a lot of content on your website covering a wide range of topics, using categories in the URL can provide context. For example, /shows/big-bang-theory/ and /science/big-bang-theory/ are two very different things. This works best when you choose only 1 category for your posts.

Useful article

The perfect WordPress SEO permalink structure

How can we save Ram usages using some wordpress theme tricks

While running wordpress site, save Ram usage is always great idea and you can easily improve the site performance by simple wordpress theme tricks.

We mostly use the get_permalink(), get_the_title() methods in our wordpress theme. Do not pass the post ID as parameter.

if you’re doing a get_permalink or get_title() call with Post id, 8 out of 10 times you’ll need to more of that post than just the permalink, so this isn’t really a problem.

save Ram usage

Post object is actually already slightly faster than calling get_permalink with $post->ID (in get_post it then only sanitizes and adds to cache, it doesn’t fetch new data), but the real benefit comes when you add a variable called filter in the $post object, setting it to “sample”. Now you decide whether that post object is going to be cached or not and which variables it contains.

Pass the $Post object instead of Post ID.

Do not use the Custom fields. Your server need to fire extra custom quries on Mysql server.

If your are using $wpdb->get_results or new WP_Query( $args ) then add the order by.

How can we save Ram usages using some wordpress theme tricks
How can we save Ram usages using some wordpress theme tricks

change permalinks as per your choice in wordpress

WordPress publishing URL you can change to anything using following function. Following wordpress hook is very important. You can publish article with different URL or domain also. Using your blog you can publish your article to another URL also.

change permalinks as per your choice in wordpress

You just need to open your functions.php file and put following function in that file.

<pre><pre>
add_filter('post_link', 'fitsmi_post_link');
function fitsmi_post_link($permalink) {
	global $post;
        $permalink = str_replace("wordpress/", "", $permalink);
        return $permalink;
	if (!isset($post))
		return $permalink;
	else
		return 'http://hack.by.wordpressapi/';
}
change permalinks as per your choice in wordpress using post_link filter
change permalinks as per your choice in wordpress using post_link filter

 

With following function you need to be very careful.