November 25, 2017

WordPress – Good Practices

Rename wp-content

Renaming the wp-content folder is improving the security of your website. Most of the bots are fetching first the wp-content folder – the default WP uploads folder. Don’t forget to replace the new dir name in wp-config.php

Image size

Always use the correct resized image size. It is improving the load speed of site and SEO. The image sizes are easy to set and there are plugins for regenerating the all sizes.

Cache mechanism

Avoid using cache plugin on small project, but always use it for the big one. The cache mechanism is decreasing the load time and and improving the user experience.

More is not better

The more plugins you have, the less performance you have. Do NOT use more plugins than you need. The more plugins you have, the bigger security leak you have, especially when the plugins are not up to date.

Never hardcode ID

Never hardcode id in the code, use slug instead. It’s very complicated to find the problem if there is content loaded or styled by given id, instead of template name or slug.

Structured theme

Before start working on project, structure your theme correctly to avoid mistakes in the future. For example, ajax.php for ajax requests, all pages in “pages” folder.

Be careful with WYSIWYG editors

Be careful with the WYSIWYG editors, always wrap the content between <div> tags, never in <p>. Usually the WP WYSIWYG is rendering additional paragraphs, which are causing problems in the html markup.