Support

Account

Home Forums Backend Issues (wp-admin) How to use JavaScript API in attachment?

Helping

How to use JavaScript API in attachment?

  • Hello,

    I am using the great ACF JavaScript API documentation successfully. Except when using following location.

    
    [...]
    'location' => array (
    	array (
    		array (
    			'param' => 'attachment',
    			'operator' => '==',
    			'value' => 'image/jpeg',
    		),
    	),
    ),
    [...]
    

    The ACF are shown correctly but it seems impossible to run additional JavaScript Code here.
    How to add ACF JavaScript API to wp.media? I couldn’t find out how to trigger the modal window where the ACF are shown. I want to run the ACF JavaScript code example:

    
    acf.addAction('enable_field/name=image-description', function() {
    console.log('image description trigger activated');
    });
    

    Is there a listener or something like that for attachment modal window available to trigger the code when the following modal is shown (see image)?
    attachment modal window

    Thanks for your help!

    Greetings
    Andre

  • I would try using the ready_field action

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.