pioupiou75
pioupiou75

Reputation: 3

Wordpress : Add a translated string to a variable?

I would like to save a translated string in a variable without displaying it.

I have actually this code :

<?php $str = _e('mystring', 'myplugin' ); ?>

Any suggestions?

Upvotes: 0

Views: 100

Answers (1)

Pieter Goosen
Pieter Goosen

Reputation: 9941

You can use the __() function that returns the value. _e() echo's the value to screen.

Use

<?php $str = __('mystring', 'myplugin' ); ?>

Upvotes: 1

Related Questions