Author: webhead

WordPress REST API schema property format: email

Problem:  When setting a property type to ’email’ like so: $schema = array( ‘$schema’ => ‘http://json-schema.org/schema#’, ‘title’ => ‘user’, ‘type’ => ‘object’, ‘properties’ => array( ’email’ => array( ‘description’ => __( ‘The optional email address for the something.’ ), ‘type’

Posted in Coding Tagged with: ,

WordPress Capabilities with map_meta_cap and user_has_cap

The two functions, map_meta_cap and user_has_cap allow you to change capabilities on the fly without having to add to roles in the database.  These also allow you to have a ton of flexibility. Some examples from the talk:  If you can

Posted in Coding

WordPress 4.6 crashed my site

Fatal error: Cannot redeclare the_post_thumbnail_caption() (previously declared in …. This error occurs because the_post_thumbnail_caption is a new function in WordPress 4.6.  However, people have been using this function for over 5 years now.  How?  Stackoverflow and other WordPress forums are flooded with

Posted in Coding Tagged with: ,

Escape strings for use in JavaScript

When using parameters from the URL, it should always be sanitized before using it in your javascript. Using jQuery you can easily do: var safeString = $(“<span></span>”).text(unsafeString).html(); Using plain javascript: var entityMap = { “&”: “&amp;”, “<“: “&lt;”, “>”: “&gt;”,

Posted in Coding Tagged with: , ,

Left Sidebar Under Content

Problem Having a left sidebar move under the content in a responsive design needs a bit more thinking.  You can’t just do float left width 100% or display block and let the sidebar fall to the next line. Solution When

Posted in Coding Tagged with: ,

Run WP-Cron with no visitors

Got a website with noone visits or simply a website that is private but still need WP-Cron to be run?  no problem, you have 2 easy options. 1) Setup a free account with set https://www.setcronjob.com ( i like them better because they

Posted in Coding Tagged with:

Macbook and the read only SD Card

Until recently I thought my SD cards from my camera were write protected by the camera formatting.  Apparently it’s just my macbook pro being flaky.  The macbook has some flaw where even when switching off the manual lock switch, SD

Posted in Random Thoughts

Order Non-hierarchical Custom Post Types

Non-hierarchical post types are like regular posts which normally do not have a menu_order attribute.  Hierarchical post type are like pages which allows a parent/child and is normally ordered by the menu_order attribute.  What if you have a custom post type that

Posted in Coding Tagged with: ,

Moving Email Hosts

Transferring where your email is hosted can be tricky.  When moving from one host to another email is usually stored with the hosting plan.  If you have bad luck with hosting companies you may want to consider hosting your email on

Posted in Server Stuff Tagged with:

iPad textarea not selectable

Problem The textarea on iPad could not be selected and could not have anything entered. Solution The textarea in iPad only responds to the ‘touchstart’ event and not the ‘click’ event, but regular input accepts the ‘click’ apparently.  I some javascript where it would catch

Posted in Coding Tagged with: , ,