0

For example I have this code which gets the post title:

function baracuda_sinlge_post_title(){ // Single Post Title
        $post_title = single_post_title('','0');
        return $post_title;
    }

Where do you think it would run faster, in functions.php or direcly in the template I need it to be like this:

$post_title = single_post_title('','0');
3
  • 3
    Can you explain what you're trying to do? On its face, I can see no reason to create a wrapper function that simply returns the content of another function that returns content. Commented Aug 4, 2012 at 14:02
  • This was just an example, it can be anything inside the function. Commented Aug 4, 2012 at 14:04
  • Can you give us your specific example? Commented Aug 4, 2012 at 14:22

1 Answer 1

4

It doesn't matter. I know you think it matters, but it doesn't. The reason it doesn't matter has nothing to do with which one is actually faster. The speed of your website will NEVER be influenced by the placement of this function. Theoretically, sure, but in practice you'll never see it. The only two places to spend time are the front end bandwidth and back end DB calls. That's it. The front end will be too heavy, have too many http requests, errors, and a plethora of other front end issues. And the database is typically the biggest bottleneck on a website.

If you're not spending time in these two areas, you're wasting time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.