Widget plugin and input file

add_action(‘post_edit_form_tag’, ‘post_edit_form_tag’); function post_edit_form_tag() { echo ‘ enctype=”multipart/form-data”‘; } Add the above code in your active theme’s functions.php file. Then print_r($_file) will display the file array.

How to change url’s in WordPress when changing domain [duplicate]

I had much success using https://github.com/interconnectit/Search-Replace-DB Though there are Plugins for WordPress available that do a Search & Replace, i recommend the above linked script. In older WordPress versions it was possible to move an entire site by simply replacing some strings, but as far as i know, WordPress now creates hashes/indexes for some strings … Read more

Open media box library from link

By enququing an JS file we can do like this: <img src=”#” id=”img-src”> <a href=”#” id=”img-upload”>Add Image</a> Content of JS file jQuery(document).ready(function(e){ e.preventDefault(); jQeury(‘#img-upload’).click(function(){ var upload = wp.media({ title:’Choose Image’, //Title for Media Box multiple:false //For limiting multiple image }) .on(‘select’, function(){ var select = upload.state().get(‘selection’); var attach = select.first().toJSON(); console.log(attach.id); //the attachment id of … Read more

Sending Parameter Failed

When an action is defined, the parameters passed to the callback are defined as well. For example, you can define an action with 4 parameters: $a = 1; $b = 2; $c = 3; $d = 4; do_action( ‘name_of_my_action’, $a, $b, $c, $d ); Then, when you hook in that action, you can tell how … Read more

Only admin should run wordpress plugin shortcode

Fatal error: Call to undefined function wp_get_current_user() This can be fixed by declaring check_user_role only when WP is ready, hooking into wp (to use WordPress functions and methods) or performing other workaround. Simply check if manage_options capability is there for the user too ( or verify if administrator is in the roles list in_array( “administrator”, … Read more

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