Is it possible to insert the Site Title in a widget text box?

I tried <?php wp_title(); ?> but nothing displayed.

  • Please don't abuse the php tag. Please read the tag descriptions before using them, and make sure that the tags you choose is relevant to your problem – Pieter Goosen Dec 21 '14 at 17:55

The Text Widget does not parse PHP - it even strips it.

You either could use a widget that is capable of parsing/interpreting PHP, such as the PHP Code Widget, or you could develop your own widget.

Here is a very simple example of how this could look like:

class WPDev172911TitleWidget extends WP_Widget {

    public function widget( $args, $instance ) {


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.