ColoursB
ColoursB

Reputation: 31

Translation function calls must NOT contain PHP variables

I'm using the Theme-check plugin, and it's helped me cleanup my theme quite a bit. One of the recommended changes I make says the following: 'Possible variable $options found in translation function in theme-options.php. Translation function calls must NOT contain PHP variables.'

What I have is <input id='critter_theme_options[phonenumber]' class='regular-text' type='text' name='critter_theme_options[phonenumber]' value='<?php esc_attr_e( $options['phonenumber'] ); ?>' />

What is the correct way of saying esc_attr_e( $options['phonenumber'] );?

Upvotes: 0

Views: 1087

Answers (1)

Mainz007
Mainz007

Reputation: 543

Here is explained pretty well what to do to make it work.

EDIT (from comment): So in your case

printf( "
  <input id='critter_theme_options[phonenumber]' class='regular-text' type='text' name='critter_theme_options[phonenumber]' value='%s' />",
  esc_attr( $options['phonenumber'] ) ); 

Upvotes: 1

Related Questions