WordPress Tips

WordPress tips, hacks and tricks

I've created this section to share the discoveries I find and use daily that help developing WordPress websites so much easier. Its also a great reference for me to revisit when creating new WordPress websites. I hope you find it useful, but please remember, Four Foot Websites cannot be held responsible for any loss or damage caused by following any of these instructions. Its always best to try these out in a testing environment before applying to live websites. The information that finds its way to these pages has been used successfully when I have developed a WordPress website though. Please do feel free to let me know of any outdated or incorrect information. Cheers.....Miles
  • Remove WordPress emoji code in your pages head without plugin (8/28/2017) - WordPress has added a cluster of code in the headers for Emoji support. To remove it from the source code, add the following code to your functions.php file.
  • Redirect http to https using .htaccess file in wordpress (8/28/2017) - To redirect visitors to the https section of your website, use the following code. This code should be included with the mod rewrite code for WordPress permalinks. Warning: be careful with htaccess files as incorrect code can break the website. Remember to test afterwards making sure your site is working as it should. Its important […]
  • Adding a new custom field (12/10/2016) - Easily and quickly add a new custom field to posts and pages by using the Add custom field option. You can have a pre-set in there too by adding this code to functions.php Source: https://www.thewebtaylor.com/articles/wordpress-adding-default-custom-fields-on-new-posts add_action('wp_insert_post', 'set_default_custom_fields'); function set_default_custom_fields($post_id){ if ( $_GET['post_type'] == 'post' ) { add_post_meta($post_id, 'Field Name', '', true); add_post_meta($post_id, 'Another Field Name', […]
  • Allow html in WordPress titles title (12/6/2016) - Add this code to functions.php file (Child Theme) Source: https://premium.wpmudev.org/blog/wordpress-widget-title-html function html_widget_title( $title ) { //HTML tag opening/closing brackets $title = str_replace( '[', '<', $title ); $title = str_replace( '[/', '</', $title ); // bold -- changed from 's' to 'strong' because of strikethrough code $title = str_replace( 'strong]', 'strong>', $title ); $title = str_replace( […]
  • Adding a development copy of a live website to MAMP (9/6/2016) - How to add a development copy of a live WordPress website to a local MAMP installation Using an offline testing website has many advantages. Search Engines won't crawl and rank a website on a local computer and development is sped up by not needing a fast internet connection. In fact, you don't need to be […]
  • Add Facebook Elements Adding Facebook Elements to WordPress pages (9/2/2016) - Add Facebook social elements to a WordPress page. Can be added using 2 methods, iFrame and Javascript SDK. No need for a plugin. Make sure you add the header.php file to your child theme to make it update proof. Elements that can be added Save Button Like, Share, Send, & Quote Embedded Posts & Video […]