Remove words automatically from the URL

 shorter line from one point to another

The other day, when we saw the trick for automatically remove short words from the URL the reasonable doubt arose of the problem that this automatism can arise, since you do not really control the result when the only element of control that you put is the number of letters .

With the previous method you could get unwanted results, and also is not very flexible.

So it was mandatory to find a code that offered the same thing: shorten the URL by eliminating unnecessary words, but controlling that it is deleted . I think the best is to make a list of words to remove from the URL, which you choose yourself where you will incorporate articles, pronouns and other unnecessary elements for a URL, or the words you want.

For C onseguirlo you have to add this code to your function plugin or file functions.php of the active topic:

What does this code do? If it finds words of 3 or less letters, it removes them from the URL, as simple as that. In this way, a URL like this:

It would be this otherwise automatically :

Shorter, easier to remember without possible errors of omission, and more focused on keywords, removing all that remains for search engines and for i todos.

If 3 letters per word seems like a lot, because they could leave out relevant words for your website, change line 7 to the number you want.

Of course, you can always do it manually in each entry …
 shorten permalink wordpress

Personally I prefer to do it manually, you know that I do not like this type of automation because you can leave out relevant words even for usability and keywords, but if you convince for some web that you have at least you know how to do it.

NOTICE : this publication is from two years ago or more. If it's a code or a plugin it might not work in the latest versions of WordPress, and if it's a news story it might be obsolete. Then do not say we have not warned you.

Loading …

That may also help you:

Custom fields in WordPress • WordPress Help

Also known as customs fields custom fields are aggregated metadata.

What is a metadata? [19659004] According to Wikipedia are data that describe other data. In general, a group of metadata refers to a group of data, called a resource.

The concept of metadata is analogous to the use of indexes to locate objects instead of data. For example, in a library they use tokens that specify authors, titles, publishing houses and places to look for books. Thus, the metadata help to locate data.

Yes, they are data about a data, and we live with them everywhere from the index of a dictionary, through the ID3 of an mp3 (the "Place" where the data is saved as an artist, album, genre) and ending with the EXIF ​​information, which stores information about time, date, camera model and others about the images taken by digital cameras.

custom fields.

Before continuing with the post, it is necessary to clarify that WordPress has by default several general fields among which are, name of post, subtitle of post (post slug), post date, categories, tags and so on.

This amount of metadata is enough for most bloggers, but luckily and since WordPress is a very complete tool, it allows the addition of other fields, depending on our need.


(And that of many plugins that use the custom fields without our direct intervention)

Let's see the example of blissful the I needed to show how much I was running and what I was reading.

Or without going far back, the theme Unstandard due to the special nature of the template makes use of the custom fields, linking 2 images to each post.

As you can see the custom fields are incredibly versatile, and although as a blogger you surely do not use it directly, knowing that they exist can be useful for a future project.

To know more:

I killed her for a yogurt : Custom fields in WordPress.

Yukei: Commenting on some functions for WordPress

Sisifodichoso: Custom fields

Codex WordPress: Using custom fields

NOTICE : est The publication is two or more years ago. If it's a code or a plugin it might not work in the latest versions of WordPress, and if it's a news story it might be obsolete. Then do not say we have not warned you.

Loading …

That may also help you: