Home Forums General Issues Gallery: Related Images "Uploaded to"… Problem! Reply To: Gallery: Related Images "Uploaded to"… Problem!

  • Oh, I completely missed this! I’m so sorry. Thanks so much for your help. The formatting got a bit wonky but I fixed it up as best as I could and ended up with this code:

    add_action('acf/save_post', 'remove_att_from_att');
    function remove_att_from_att($post_id) {
    	$post_type = get_post_type($post_id);
    		if ($post_type != 'attachment') {
    	$children = get_children($post_id);
    		if ($children) {
    			// remove filter so this filter does not run again
    			remove_filter('acf/save_post', 'remove_att_from_att');
    			foreach ($children as $child) {
    				$child->parent = 0;
    		// restore filter
    		add_action('acf/save_post', 'remove_att_from_att');

    Which, unfortunately, didn’t work; the images still get attached every time I save a post. Did I make a mistake with my tweaks or is there something else missing?