Post ID wrong in Functions.php
<p>I am trying to execute the following code inside my functions.php to change the title of my wordpress blog.</p>

<pre><code>function filter_pagetitle($url) {

        global $wp_query;

        $the_post_id = $wp_query-&gt;post-&gt;ID;
        $the_post_data = get_post($the_post_id);

        return $the_post_data-&gt;post_title;
}

add_filter('wp_title', 'filter_pagetitle');
</code></pre>

<p>However, $the_post_id always comes back as the same one, and never changes to the ID of the post that I am viewing?</p>

<p>What am I doing wrong?</p>
