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 am looking to start work on a brand-new project, something I've been thinking
I'm brand new to Prolog. I am simply trying to get some output from
I'm brand new to the Entity Framework and trying to learn all it can
I am brand new to C# (VS 2010) and I'm trying to understand how
I'm brand new to SQL and I'm trying to understand the following script. could
I'm not brand new to the concept of unit testing but at the same
I am writing an install script that installs all tables, stored procedures, views, full
I'm trying to speed up a python routine by writing it in C++, then
I have a C++/Obj-C background and I am just discovering Python (been writing it
I'm writing a simple program in Matlab and am wondering the best way to

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.