Viewing 5 replies - 1 through 5 (of 5 total)
  • krasentomov

    (@krasentomov)

    How you’ve resolved this? I’m experiencing the same problem, but with titles instead. I was using:

    $object = new WPSEO_Frontend();
    $removed_text = $object->title( false );

    And then I’ve echoed the desired title, but now I get “Fatal error: Call to protected WPSEO_Frontend::__construct() from invalid context in ….”

    I get that with 1.7.3.

    Edit: Same problem with 1.7.2. I’m back to 1.7.1 until the problems are resolved.

    Thread Starter deadhippo

    (@deadhippo)

    Like you I am back to 1.7.1

    As Rarst stated:

    As per error message the class isn’t meant to be instanced directly.
    From quick look you should probably be able to do $object = WPSEO_Frontend::get_instance(); instead.

    Thread Starter deadhippo

    (@deadhippo)

    Thanks. It worked perfectly.

    This worked initially but since the recent updates to the plugin it no longer works properly. I am using this on a home page to get the meta descriptions of other posts to display on that home page.
    Since the recent updates (1.7.4 onwards possibly before that). The meta description retrieved is always that of the home page not the current post.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Code to Display Meta-description on front end broke’ is closed to new replies.