WordPress __() translation function not working to output array value

This is what I am trying to do :

$meta_display_data = array(
    'azc_publication_date'  => array('placeholder' => __('Date de l'article', 'azc-publication')),
    'azc_publication_title' => array('placeholder' => __('Titre de la revue', 'azc-publication')),
    'azc_publication_link'  => array('placeholder' => __('Lien vers l'article', 'azc-publication')),
);

But on line 2, 3 and 4 (the content of my associative array) Apache returns :

Read More
Parse error: syntax error, unexpected '(', expecting ')'

I am not sure why this wouldn’t work. Is there a specific way to use the __() function to populate an associative array in WordPress?

Outputting the strings directly, the code is working fine, so the parenthesis issue does come from the __() function.

Thanks a lot for clarifications.

Related posts

Leave a Reply