• Hello,
    I was wondering how can I change title, meta and other tags in <head> via plugin ? I have created interstitial page, that will show up when user clicks on an outbound link and before the exist page appears.

    Page is being created dynamically, so title and other info will not be same all the time.

    add_action('wp_head', 'my_head'); //
         function my_head(){
            echo '<title> $MyVar->title; </title> ';     }

    Above just adds additional title tag, and does not alter the current one.

    Please advice.

Viewing 2 replies - 16 through 17 (of 17 total)
  • Moderator bcworkz

    (@bcworkz)

    MVC. There’s a twist I was not expecting. I should of had a clue when you first mentioned ‘view’. I’m afraid I cannot help with any MVC implications. All I can say is in a typical WP installation, a global assigned in a plugin is available to an action hook as long as both declare the global in their respective scopes. Thus the code as I recently illustrated will work in a normal WP installation.

    I cannot begin to suggest how to pass values from view back to model. Sorry ??

    Thread Starter hz-ar

    (@hz-ar)

    Hello again,
    I am trying to achieve same task via WordPress Custom page template. I tried same thing:
    add_action( ‘wp_title’, ‘AR_seo_head’ );
    function AR_seo_head($seotitle){ echo $seotitle; }

    but this time it does not work at all…

    Please guide.

Viewing 2 replies - 16 through 17 (of 17 total)
  • The topic ‘How to edit tags in head via plugin?’ is closed to new replies.