New answers tagged

0

try change to this one $upload_dir = wp_upload_dir(); $fp = fopen( $upload_dir["basedir"] . '/artworks.js', 'w+');


1

Try this add_filter('upload_dir', 'upload_image_specific_calback'); function upload_image_specific_calback( $param ){ //$_GET['post'] which is your target post like 10 is post id. //After click update button. if(isset($_GET['post'])){ if($_GET['post'] == 10){ $param = array( 'path' => get_home_path().'logos', ...


1

The filter you'd want to use is upload_dir. Check for the post_id key in the $_REQUEST super global array to be equal to the page ID you want to limit this for. Then change the uploads directory accordingly. In code: add_filter( 'upload_dir', 'my_uploads_dir' ); function my_uploads_dir( $param ){ // change this to the ID of your page $post_id = ...


-1

Add this in your wp-config.php file define( 'UPLOADS', 'custom_folder' ); And make sure to add this code before that. require_once( ABSPATH.’wp-settings.php’ ); For more information you can check here https://premium.wpmudev.org/blog/change-default-wordpress-uploads-folder/ Thanks


0

I've ruled out this being an issue with Advanced Custom Fields, so I've made a new question. For more information, please look at: wp_get_attachment_image_src multisite issue


1

Possibilities to fetch attachments WordPress saves files not only to a physical disk, but as well as attachment post type into your MySQL/MariaDB database. This means you have two possibilities to query for uploaded files and you have to chose what you need in which scenario/context. Filesystem only To loop through all files or a specific type in a ...


1

There is an error in your src; <img src="http://example.com//wp-admin/admin-ajax.php?action=random_banner"> Try this one: <img src="http://example.com/wp-admin/admin-ajax.php?action=random_banner"> or <img src="<?php echo admin_url( 'admin-ajax.php?action=random_banner' ); ?>"> You can also use a query to get a random image. ...


0

After some intensive Googling I discovered a couple of plugins for just this purpose. This is the one I used: Regenerate Thumbnails


2

Doing this on your own is actually quite a lot of work. For the sole purpose of regenerating your custom image sizes I would recommend using this plugin: AJAX Thumbnail Rebuild It allows you to loop through your Image Library and regenerate the different image sizes that you selected.


0

From my experience if an ajax call in wordpress returns 0, it means that ajax can't find the related php function, so check three times that the function you point to in 'add_action', function name and the action of your form do match. I usually include an action attribute in the ajaxSubmit options as well, maybe it solves your problem. Just add action : ...


1

Ok, seems I was on the right track... I still haven't found a WordPress function that achieves what I need, but the closest I have found is to use the get_allowed_mime_types function. I created the following function which checks if the file is within the get_allowed_mime_types array and if so returns true (file processed using wp_insert_attachment, ...



Top 50 recent answers are included