Distinguish between 2 instances of admin-ajax.php

There isn’t much point to distinguishing admin-ajax.php since it’s essentially same file with same logic running for many many purposes. You are passing action data and hooking into respective action. So action is your identifier. If you are reusing same action and need to further differentiate — just pass more data with your GET/POST request … Read more

Automatically Insert Into Post when uploading Media

That’s the pre-3.5 media interface so I think you must be on 3.4.x? Anyway the first way should work as long as you’re using the browser (non-multifile) upload… try changing add_filter( ‘flash_uploader’, ‘_force_html_uploader’ ); to add_action( ‘pre-html-upload-ui’, ‘_force_html_uploader’ ); and the “js/upload.js” (note the subdirectory – it’s expected to be in a “js” subdirectory of … Read more

How does wordpress name resized image copies?

yes, the naming convention for resized images is name-{width}x{height}.extension. Is it good enough info to base a regex on? in practice most likely yes, but in theory no. You just can’t know if mark-20×20.jpg was not simply uploaded that way, and even in places where you know that a resized image should be used you … Read more

HTTP error when uploading an image

I’ve had the same problem and found it was due to the upload file size set for the server (in my case 2mb). There is another setting which escapes me at this point, but is basically a limit on the amount of space that can be used to process uploaded images…which WordPress does when it … Read more

Capitilize Alt/Title Tag in Image HTML, Reorder HTML Output

I’ll give you a partial answer. In your first function you may use ucwords() PHP function: $alttitle = ucwords( str_replace( ‘-‘, ‘ ‘, $alt ) ); Second task is more complicated. I don’t have a ready solution for you but the direction should be to extract attributes and values from HTML (playing with preg_match()), store … Read more

custom plugin with upload files does not work

Use WordPress defult media uploader and get uploaded link in jquery response it is quit easy <label for=”upload_image”> <input id=”upload_image” type=”text” size=”36″ name=”ad_image” value=”http://” /> <input id=”upload_image_button” class=”button” type=”button” value=”Upload Image” /> <br />Enter a URL or upload an image </label> <?php add_action(‘admin_enqueue_scripts’, ‘my_admin_scripts’); function my_admin_scripts() { if (isset($_GET[‘page’]) && $_GET[‘page’] == ‘my_plugin_page’) { wp_enqueue_media(); … Read more

Disable image rename on upload

The renaming to test1.jpg is not due to any cropping / resizing functions WordPress. This is because you already had a file named test.jpg uploaded, and WordPress does not replace files if one exists in the folder that has the same name. If, for some reason you want it to replace files rather than rename … Read more