Skip to content

Instantly share code, notes, and snippets.

@srikat
Created October 18, 2023 05:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save srikat/6144828b9d4572ecbf2a470290b596c5 to your computer and use it in GitHub Desktop.
Save srikat/6144828b9d4572ecbf2a470290b596c5 to your computer and use it in GitHub Desktop.
Adding Posts in the Homepage and Posts page dropdowns at Settings > Reading in WP admin
add_filter( 'get_pages', function ( $pages, $r ) {
if ( function_exists( 'get_current_screen' ) && 'options-reading' === get_current_screen()->id ) {
$pages = array_merge( $pages, get_posts( ['post_type' => 'post'] ) );
}
return $pages;
}, 10, 2 );
@srikat
Copy link
Author

srikat commented Oct 18, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment