WordPress is a great tool. With quite basic programming knowledge you can easily get started. If you are one of WordPress developers or your understanding of programming language is decent, there are many blogs online that will help you with almost everything you want to do on WordPress. But also it’s quite easy to lose track while working on WordPress.
Let’s face it, it’s just too much of everything. Too many options that have too many solutions and even the best of us struggle in search of that one best solution. Hence we asked our best remote database administrator experts to give us some tips and snippets to make our lives easier.
Page Contents
Remote DBA tips for WordPress developers
Do not use query_post()
There are many reasons for you to not use this command. Even though it is the simplest version of loop, it will run a lot of background operations and will in fact increase the mess for you to clean up later. Instead as a WordPress developer you should use WP_Query whenever you need multiple number of loops. Hence sidebar, secondary loops like functions will be a lot better when you use this function.
Enqueue your scripts and styles
It is a general observation that while creating a new theme, a plugin or while customization, it may be required to load multiple external files. And each of these may contain a lot of things. You will always have a threat of breaking the site if you call JS library more than once.
To tackle this issue, we recommend you to use, wp_enqueue_script. By doing this you can make sure that while loading a library or a script, you are loading only one copy of it. And redundancy is eliminated. And the same logic is applicable for styles. But styles don’t cause as much trouble. But still it should be a standard practice to enqueue the scripts and styles.
Cache
Transients API allow you to store small data like options for limited short period of time. It’s like if you are getting an update at regular intervals, there really isn’t much sense in in loading everything at once, and instead you can set a transient to load it after a regular interval of say 30 seconds.
Know cool feeds
There are quite a lot of cool feeds you can use best remote database administrator expertise list down a few for you
- Main – site.com/feed
- Main comments – site.com/comments/feed
- Post comments – site.com/post-name/feed
- Categories & tags – site.com/category/categoryname/feed or site.com/tag/tagname/feed
- You can also include / exclude categories like this – site.com/?cat=42,25,17&feed=rss2 or this site.com/?cat=-123&feed=rss2
- Author – site.com/author/authorname/feed/
- Search – site.com/?s=searchterm&feed=rss2
- Custom Post Type – site.com/feed/?post_type=yourposttype
- Custom Taxonomy – site.com/feed/?post_type=custom_post_type_name&taxonomy_name=taxonomy
Add featured images, make it interactive!
This is one of the most basic yet effective tools. Add this code in your functions file.
function featured_image_in_feed( $content ) {
global $post;
if( is_feed() ) {
if ( has_post_thumbnail( $post->ID ) ){
$output = get_the_post_thumbnail( $post->ID, 'medium', array( 'style' => 'float:right; margin:0 0 10px 10px;' ) );
$content = $output . $content;
}
}
return $content;
}
add_filter( 'the_content', 'featured_image_in_feed' );
Optimized DB means efficiency!
It really doesn’t matter how you do it, manually or by use of a plug in, but it’s always a goof practice to optimize your MYSQL tables from time to time. Ideally a couple of times a month is sufficient.
By doing this you ensure that your queries are as good as they can be and will also help reducing your DB size.
Really, wordpress is a great tool for developing websites with less knowledge of programming. This article explains the remote dba tips for the wordpress developer. This article is very helpful for me as I am a wordpress developer. The main part is to handle the database. If you have any problem with the database then you can search for remote dba support and get helped. Thank you Jenny for posting such a great article.