Coder Social home page Coder Social logo

TypeError: ShortNotes\PostType\Note\get_reply_to_markup(): Argument #1 ($post) must be of type WP_Post, null given, called in /var/www/html/wp-content/plugins/shortnotes/includes/post-type-note.php on line 383 about shortnotes HOT 4 CLOSED

aaronjorbin avatar aaronjorbin commented on August 16, 2024
TypeError: ShortNotes\PostType\Note\get_reply_to_markup(): Argument #1 ($post) must be of type WP_Post, null given, called in /var/www/html/wp-content/plugins/shortnotes/includes/post-type-note.php on line 383

from shortnotes.

Comments (4)

aaronjorbin avatar aaronjorbin commented on August 16, 2024 1

Yes, it looks like inside Yoast, the oembed data is filtered.

#45 is essentially what I did to get the error out of my logs, so I approved it. Thank you for being on top of this so quickly.

I do like the idea of bringing https://core.trac.wordpress.org/ticket/24330 back up for discussion

from shortnotes.

aaronjorbin avatar aaronjorbin commented on August 16, 2024

This is odd. It would seem as though get_post is returning null, even though we are inside the_content. I wonder if in these circumstances it would be best to just return $the_content?

from shortnotes.

jeremyfelt avatar jeremyfelt commented on August 16, 2024

@aaronjorbin good catch, thanks for reporting it! I'm guessing (hoping) you're filtering the oembed response to include an excerpt. Once I did that I was able to reproduce the issue.

The oembed handler figures out what the $post is based on the link, and then passes that around rather than set it globally. This leads to wp_trim_excerpt() not passing $post to its application of the_content.

So, I think you're right: best to just return $the_content when $post is not available. I've got a PR up for this in #45 if you want to take a look.

Aside: It looks like we almost had an expectation of $post_id as available context with https://core.trac.wordpress.org/ticket/24330, but it was pulled out. Thanks, Nacin. There is a remainder in do_trackbacks() though... Maybe it's time to bring the idea back now that blocks are flying all around.

from shortnotes.

jeremyfelt avatar jeremyfelt commented on August 16, 2024

Shipped in #45 and released in 1.6.2. Thanks again! 🍺

from shortnotes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.