Ready to get started?Download WordPress


PHP Code Widget
[resolved] PHP code not supported in the widget title (5 posts)

  1. ad4mlaz
    Posted 1 year ago #

    Hi, I'm trying to add PHP code in the widget title, but when I press save, the PHP code is removed.

    For example the widget title that I want to use is:
    More from <?php $category = get_the_category(); echo $category[0]->cat_name; ?>

    But when I hit Save, the title becomes:
    More from

    Is there any trick for allowing this to work?

    Thanks for your help.


  2. Samuel Wood (Otto)
    Tech Ninja
    Plugin Author

    Posted 1 year ago #

    You do have to be an admin and/or have the unfiltered_html capability on the site. Otherwise it'll get filtered like everything else.

  3. Samuel Wood (Otto)
    Tech Ninja
    Plugin Author

    Posted 1 year ago #

    Oh, I just saw that you are trying to put code in the TITLE. Missed that.

    Yes, the PHP Code Widget does not support PHP Code in the title.

  4. Ricky
    Posted 11 months ago #

    I know this is an old thread, but any way this plugin will support PHP code in the future? I decided to place <?php echo 'test'; ?> in the title and the entire site failed to load O.o luckily I was able to remove the widget entry from the backend and the site loaded. Scared me for a sec!

  5. nilanjanb
    Posted 10 months ago #

    the way I have done this - leave the title blank
    write code in the widget to display whatever you want

    Works for me :-)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic