Are WordPress Plugins essential?

##Plugin Necessity## What the necessity of plugins really boils down to is the question, “Am I satisfied that WordPress’s core functionality is all that I need?“ If all you want is a simple blog with some categories and a number of static pages you’re set. But if you want to start integrating interactive maps, calenders … Read more

wp.media.view.ImageDetails – Save settings as HTML5 data-* attributes for image

A way to do it is to use the (very convenient) editor:image-edit and editor:image-update events triggered by the tinymce wpeditimage plugin to get/set the dom directly (updated to wrap in wp_enqueue_media action): add_action( ‘wp_enqueue_media’, function () { add_action( ‘admin_footer’, function () { ?> <script type=”text/javascript”> jQuery(function ($) { if (wp && wp.media && wp.media.events) { … Read more

Proper Way to Modify Plugin

IMHO, the best approach is either to fork the Plugin to maintain your changes, or else submit patches to the Plugin developer, to have your changes made a part of the original Plugin. Creating a “Child Plugin” really isn’t easy. The “Child Theme” concept really applies to the template files that get used, moreso than … Read more

How to catch/what to do with a WP Error Object

Assign return of the function to the variable. Check the variable with is_wp_error(). If true handle accordingly, for example trigger_error() with message from WP_Error->get_error_message() method. If false – proceed as usual. Usage: function create_custom_post() { $postarr = array(); $post = wp_insert_post($postarr); return $post; } $result = create_custom_post(); if ( is_wp_error($result) ){ echo $result->get_error_message(); }

How to enable suggested edits?

Diff the post content, title and author As had to do something related some month ago, here’s the easiest and most future proof way (that I could fine) to check if there’s a change made to the content or title or if the author changed: // Update Title ” !== wp_text_diff( $el[‘post_title’], $GLOBALS[‘post’]->post_title ) AND … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)