Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not attempt to modify content if no global post is available #45

Merged
merged 1 commit into from
Nov 1, 2023

Conversation

jeremyfelt
Copy link
Owner

When get_the_excerpt() is called with an explicit $post, that post is passed as context to the get_the_excerpt filter.

Even though wp_trim_excerpt receives the $post as an argument, it does not provide that as context when applying the_content to the post content.

In this case, and probably other related cases, a fatal error would be generated because the global $post data we rely on is not available.

A future commit may also account for a second parameter passed to the_content, but I'll think that through some more. :)

See #44

When `get_the_excerpt()` is called with an explicit `$post`, that
post is passed as context to the `get_the_excerpt` filter.

Even though `wp_trim_excerpt` receives the `$post` as an argument,
it does not provide that as context when applying `the_content` to
the post content.

In this case, and probably other related cases, a fatal error would
be generated because the global `$post` data we rely on is not
available.

A future commit may also account for a second parameter passed to
`the_content`, but I'll think that through some more. :)

See #44
@jeremyfelt jeremyfelt merged commit ab1e2ca into trunk Nov 1, 2023
5 checks passed
@jeremyfelt jeremyfelt deleted the fix/44-oembed-content branch November 1, 2023 05:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants