json_decode does not work on WordPress

I tried to parse your JSON into this and got an error that you have bad escaped characters (backslash must be escaped). Taking into account Vinod Dalvi’s comment, the definition of json_encode in WordPress is wrapped by function_exists(). I guess if you have PHP version of 5.2 or above (which I think you have, because … Read more

jquery & ajax sending data to php

First of all, your js is wrong, you are mixing the syntax of jQuery.post() and of jQuery.ajax() You should use jQuery.ajax({ type: “POST”, url: ajaxurl, data: { action: “lu_ajax”, status: “enabled” }, success: function( data ) { alert(data); } }); or jQuery.post( ajaxurl, { action: “lu_ajax”, status: “enabled” }, function(data) { alert(data); } ); After … Read more

Declare plugin dependency [duplicate]

It’s not possible in the core. There are a few ways to approach this. 1. Hook into plugins_loaded check to see if X from your dependency plugin exists. add_action(‘plugins_loaded’, ‘wpse120377_load’); function wpse120377_load() { if (!class_exists(‘Some_Class_From_Another_Plugin’)) { // dependency not installed, bail return; } // load the rest of your plugin stuff here } Hooking into … Read more

Insert Array in Plugin Database

You should pass data as an array, not a json encoded string. So changing these line would work. Just remove the following line – $formDATA = json_encode($formDATA); if you want to see the reference, prepare sql this way $sql = “INSERT INTO `”.$table_name .”` (`paid_arr`) VALUES ‘”.json_encode($formDATA).”‘”;

WordPress Admin Login Custom Logo

I personally like to use something like this. This will look for a logo image in your templates /images/ folder or directory, then display it in place of the default WordPress Logo. function my_login_logo() { if(file_exists(TEMPLATEPATH.’/images/logo.png’)) $logo = ‘/images/logo.png’; else if(file_exists(TEMPLATEPATH.’/images/logo.jpg’)) $logo = ‘/images/logo.jpg’; else if(file_exists(TEMPLATEPATH.’/images/logo.gif’)) $logo = ‘/images/logo.gif’; ?> <style type=”text/css”> body.login div#login h1 … Read more