Tag: php

Where is wp_capabilities?

Problem After creating a user with a certain role I need to do a custom sql query where it only selected users of a specific role.  This failed to find anything: select u.ID, u.display_name, u.user_login from $wpdb->users as u inner

Posted in Coding Tagged with: , ,

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: ,

WordPress Heartbeat API

I could not find any extensive documentation on the WordPress Heartbeat API, so I am writing here to remember what I have learned through various tutorials throughout the web. The Heartbeat API is written in Javascript.  Think of it like a

Posted in Coding Tagged with: , ,

edit_users capability on multisite

No matter how hard you try, if you add the edit_user capability to a user on multi-site and that user is not a super-admin, the user will not have the edit_user capability.  This is hard-coded into WP_User’s map_meta_cap.  There is a filter

Posted in Coding Tagged with: ,

How does WordPress redirect mistyped URLs to the correct one?

Well, I’m not sure exactly because it is A LOT of code, but to make it stop, you can use the filter ‘redirect_canonical’ and return false.  like so: So say you have a post named “mission” at http://mydomain.com/mission, but for

Posted in Coding Tagged with: ,

Google Analytics Measurement Protocol for Subscriptions

Send Analytics Data Directly From Your Server Google Analytics Measurement Protocol is available for Google’s Universal Analytics.  It was released in the first part of 2013 and is as of this writing still in public beta.  It allows developers to

Posted in Coding Tagged with: , , , , ,

Free Web Hosting

Today I realized I needed a reliable web host that I can use for development purposes.  Either for demoing to clients or testing things out, it needed to be online, free (because I wouldn’t use it for production), and not

Posted in Server Stuff Tagged with: ,

Easy WordPress Localization

If you want to localize a plugin or theme or even just change some wording around, or if you are starting from scratch the easiest thing to do is install the Codestyle Localization plugin. If starting from scratch, just  make

Posted in Coding, Off the Shelf, Tools Tagged with: , ,

WP_Query and posts_per_page

Problem The following code does not seem to limit the posts to 3 posts.  Instead uses the wordpress setting of 10 posts: // The Query $the_query = new WP_Query( array( ‘nopaging’ => true, ‘posts_per_page’ => 3, ‘post_type’ => ‘post’ )

Posted in Coding Tagged with: ,

WordPress Maintenance Page

If you’ve updated WordPress, you should have noticed that wordpress goes into “maintenance mode” whenever mass plugins or WordPress itself is updated.  What if you wanted to do some manual upgrading?  Then you can manually put wordpress into maintenance mode.

Posted in Coding Tagged with: ,