• Resolved christian_gnoth

    (@christian_gnoth)


    I want check with each page request if the page has changed.

    I am using wp_title for it. I am saving the title in a session variable $_SESSION:

    $biq_title = wp_title('',false);
      if ( $biq_title == '' )
        $biq_title = 'Home';
      if ( $_SESSION['biq_last_title'] )
      {
        //  check if page has changed
        $biq_last_title = $biq_title;
        if ( $_SESSION['biq_last_title'] == $biq_last_title )
          return false;
        else
        {
          $_SESSION['biq_last_title'] = $biq_title;
          return true;
        }
      }
      else
        $_SESSION['biq_last_title'] = $biq_title;
    
      return true;

    the session variable looses its value and contains a ‘page not found’.

    If the session variable looses its value I would expect a NULL value, but how it gets the ‘page not found’????

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter christian_gnoth

    (@christian_gnoth)

    any idea how it comes???

    I tried to save the last page title in a wp option. there too the ‘Page not found’ is saved.

    Thread Starter christian_gnoth

    (@christian_gnoth)

    the wp_title returns the page title as expected and this value is stored successfully in the session variable on return of the function.

    but the next time the function is called the session variable has again the value ‘Page not found’ runs through the function and has on the end the page title.

    Thread Starter christian_gnoth

    (@christian_gnoth)

    is wp changing the content of session variables???

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘how to get title of viewed page’ is closed to new replies.