This changeset introduces `$post` parameters to `get_the_content()` and `wp_trim_excerpt()`. When a `$post` object is passed to one of these functions, the functions will operate on the data from that object, rather than from the post globals (`$authordata`, `$page`, etc). This ensures that the functions work in a predictable manner when used outside of the regular post loop. The global-mismatch problem is surfaced in cases where `get_the_excerpt()` is called outside of the post loop, on posts that don't have a defined excerpt. In these cases, the post globals - used to generate a fallback excerpt - may refer to the incorrect object, resulting in PHP notices or other unpredictable behavior. See #36934 for a related issue. Props spacedmonkey, kraftbj, Shital Patel. Fixes #42814. Built from https://develop.svn.wordpress.org/trunk@44941 git-svn-id: http://core.svn.wordpress.org/trunk@44772 1a063a9b-81f0-0310-95a4-ce76da25c4cd
277 KiB
277 KiB