: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
foreach ( $revisions as $revision ) {
if ( ! current_user_can( 'read_post', $revision->ID ) ) {
$is_autosave = wp_is_post_autosave( $revision );
if ( ( 'revision' === $type && $is_autosave ) || ( 'autosave' === $type && ! $is_autosave ) ) {
$rows .= "\t<li>" . wp_post_revision_title_expanded( $revision ) . "</li>\n";
echo "<div class='hide-if-js'><p>" . __( 'JavaScript must be enabled to use this feature.' ) . "</p></div>\n";
echo "<ul class='post-revisions hide-if-no-js'>\n";
* Retrieves the parent post object for the given post.
* @param int|WP_Post|null $post Optional. Post ID or WP_Post object. Default is global $post.
* @return WP_Post|null Parent post object, or null if there isn't one.
function get_post_parent( $post = null ) {
$wp_post = get_post( $post );
return ! empty( $wp_post->post_parent ) ? get_post( $wp_post->post_parent ) : null;
* Returns whether the given post has a parent post.
* @param int|WP_Post|null $post Optional. Post ID or WP_Post object. Default is global $post.
* @return bool Whether the post has a parent post.
function has_post_parent( $post = null ) {
return (bool) get_post_parent( $post );