Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 875373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:15:31+00:00 2026-05-15T11:15:31+00:00

I am brand new at writing WordPress plugins, so to start I am trying

  • 0

I am brand new at writing WordPress plugins, so to start I am trying to create a simple one that just modifies a string. I wrote the script a while ago, and know that it functions. But to use it for WordPress I want to apply it to the post titles. When I replaced the string with the function “get_the_title()” it returns a white screen. I stripped it down to:

function display_title() {
echo get_the_title();
}

add_action('the_title', 'display_title');

This still returns a white screen. So I figure it must be the “get_the_title()” function. Can anybody explain to me why this doesn’t work, and maybe a different way to retrieve the title string?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T11:15:31+00:00Added an answer on May 15, 2026 at 11:15 am

    As John says the_title is a filter rather than an action hook, although your function will be called regardless of whether you register it using add_filter or add_action.

    Your problem is that with filters your function is expected to return a value (normally a modified version of the argument passed). So, to modify the title using this filter you should do something like this:

    function display_title($title) {
        $title .= '!'; // Do something with the title string here
        return $title;
    }
    
    add_filter('the_title', 'display_title');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm brand new to lua and LÖVE. I am trying to do a simple
Brand new to Python (and programming in general), if this is simple and/or answered
Brand new to Cocoa and I'm trying to figure out how to copy an
I'm brand new to C++ and am having trouble trying to get a function
I'm brand new at Python and I'm trying to write an extension to an
I'm brand new to Ruby/Rails/RSpec, and hopefully this is a dumb/simple question. I'm currently
I am looking to start work on a brand-new project, something I've been thinking
I'm very new to C and I'm writing a Ruby C Extension. One of
In my brand new data warehouse that is built (of course) from the OLTP
Brand new to jQuery. I was trying to set up an event listener for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.