Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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');
share|improve this question
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. –  Chip Bennett Aug 4 '12 at 14:02
    
This was just an example, it can be anything inside the function. –  webmasters Aug 4 '12 at 14:04
    
Can you give us your specific example? –  Chip Bennett Aug 4 '12 at 14:22
add comment

1 Answer

up vote 4 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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