Right now the ajax_select() function handles parsing the $_REQUEST global as well as creating the placeholder attachment post, follow up actions and returning a JSON response.
If this functionality were to be required for an import script, or script that converted local attachments to global ones for example, it would have to be recreated wholesale.
We should split ajax_select() into 2 functions, one that handles the $_REQUEST global and returning JSON, and one that accepts parameters necessary to create the local placeholder attachment posts for global images.
Right now the
ajax_select()
function handles parsing the$_REQUEST
global as well as creating the placeholder attachment post, follow up actions and returning a JSON response.If this functionality were to be required for an import script, or script that converted local attachments to global ones for example, it would have to be recreated wholesale.
We should split
ajax_select()
into 2 functions, one that handles the$_REQUEST
global and returning JSON, and one that accepts parameters necessary to create the local placeholder attachment posts for global images.