J. Doe J. Doe - 5 months ago 8
PHP Question

My first WP plugin; how to transform a word in the text editor to PHP?

I'm looking for some proper documentation on how to change a [tag] to ?php in the WordPress editor;






So when the user types
[maintenance-date]
in their editor, it converts to $maintenance_options['disable'] which outputs the date of when maintenance is finished.

How can I do that?

Answer

You can just create a shortcode in your plugins file, or in your functions.php file

add_shortcode('maintenance-date', 'maintenance_date');
function maintenance_date() {
    return $maintenance_options['disable']
}