• I’m getting an error while creating a new post “There has been a critical error on your website. Please check your site admin email inbox for instructions.”

    When I checked the email from WordPress. It states that it is caused due to Yoast SEO plugin and it also provided me following details.

    Error Details
    =============

    An error of type E_ERROR was caused in line 47 of the file /home/aquagrn5/public_html/wp-content/plugins/wordpress-seo/admin/links/class-link-watcher.php. Error message: Uncaught TypeError: Argument 2 passed to WPSEO_Link_Watcher::save_post() must be an instance of WP_Post, null given, called in /home/aquagrn5/public_html/wp-includes/class-wp-hook.php on line 290 and defined in /home/aquagrn5/public_html/wp-content/plugins/wordpress-seo/admin/links/class-link-watcher.php:47
    Stack trace:
    #0 /home/aquagrn5/public_html/wp-includes/class-wp-hook.php(290): WPSEO_Link_Watcher->save_post(0, NULL)
    #1 /home/aquagrn5/public_html/wp-includes/class-wp-hook.php(312): WP_Hook->apply_filters(NULL, Array)
    #2 /home/aquagrn5/public_html/wp-includes/plugin.php(478): WP_Hook->do_action(Array)
    #3 /home/aquagrn5/public_html/wp-includes/post.php(4119): do_action(‘save_post’, 0, NULL, false)
    #4 /home/aquagrn5/public_html/wp-admin/includes/post.php(671): wp_insert_post(Array)
    #5 /home/aquagrn5/public_html/wp-admin/post-new.php(66): get_default_post_to_edit(‘post’, true)
    #6 {main}
    thrown

    _________________________________________
    Can you help me fix this error?

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello @prathmeshg,

    I’ll need to know if this behavior is caused by a conflict with a plugin or theme. Therefore i want to ask you to do the following;

        Log in on your WordPress website.
        Deactivate all non-Yoast plugins.
        Switch your theme to a standard theme like Twenty Fourteen.
        Test for the issue again. Does it still occur?

      Or

      you can edit the following file:

      public_html/wp-content/plugins/wordpress-seo/admin/links/class-link-watcher.php

      Edit LINE 47:
      public function save_post( $post_id, WP_Post $post ) {

      Should be:
      public function save_post( $post_id, $post ) {

      please reply me so, i will help you regarding

      Thanks

    • This reply was modified 5 years, 3 months ago by anant101289.
    Thread Starter prathmeshg

    (@prathmeshg)

    Hello @anant101289

    Thanks for responding.

    I just did what you said

    Log in on your WordPress website. (DONE)
    Deactivate all non-Yoast plugins. (DONE)
    Switch your theme to a standard theme like Twenty Fourteen. (DONE)
    Test for the issue again. Does it still occur? (DONE)

    But it was still showing me the same error

    So I tried

    public_html/wp-content/plugins/wordpress-seo/admin/links/class-link-watcher.php

    Edit LINE 47:
    public function save_post( $post_id, WP_Post $post ) {

    Should be:
    public function save_post( $post_id, $post ) {

    Now I’m able to add a new post but the interface doesn’t look the same.

    Now it is showing this error >>>
    “You are currently editing the page that shows your latest posts.”

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘I’m getting error while creating new post’ is closed to new replies.