Make display name unique

As far as I’m aware, all you can do is filter the display name via pre_user_display_name and check if it already exists. Unfortunately WP_User_Query doesn’t support querying by display_name, so we also have to add to the WHERE clause via pre_user_query. Additionally, there is no elegant way I can think of to handle the case … Read more

WordPress and magic quotes

Simply put WP turns indeterminate situation (magic quotes might or might not be enabled in server configuration) into determinate (magic quotes are always present and server configuration does not matter). Rather than messing with this for all WP core it makes much more sense to simply strip slashes in your code on your own variables, … Read more

Add filter function in media modal box

The wonderful world of Backbone.js and WP (of which I know barely anything). I think the problem is you are just calling the same default media.view, instead I believe you need to initialize a new one. For example: /** * Replace the media-toolbar with our own */ var myDrop = media.view.AttachmentsBrowser; media.view.AttachmentsBrowser = media.view.AttachmentsBrowser.extend({ createToolbar: … Read more

How can I keep the content of my pages version controlled?

You already got something like this built in: Revisions. // Define the nr of saved revisions in your wp-config.php define( ‘WP_POST_REVISIONS’, 30 ); You can simply grab them by calling get_posts() with a post_type of revision. To show the difference between two revisions simply use wp_text_diff(). // Example $revisions = get_posts( array( ‘post_type’ => ‘revision’ … Read more

Why does WordPress need my private ssh key to update?

Essentially, WordPress needs to connect back to the server where it is actually running on. There are several possible ways WordPress can use to write files and thus “overwrite” itself during an upgrade. From a security perspective, the important part of this process is that the new files must have the same ownership as the … Read more

Changing the ‘wp-admin’ URL to whatever I want

If you’re looking for a way to physically move the wp-admin folder to another location, that is indeed problematic. That’s why there is not an easy solution available. Not that it isn’t just easy, it is even the opposite. The directory name “wp-admin” is hardcoded deeply into wordpress. This is by design, so wordpress actively … Read more