Skip to content

Instantly share code, notes, and snippets.

@josecarlospsh
Last active July 29, 2020 02:39
Show Gist options
  • Select an option

  • Save josecarlospsh/073dbc89e5ce9c708c14899284869829 to your computer and use it in GitHub Desktop.

Select an option

Save josecarlospsh/073dbc89e5ce9c708c14899284869829 to your computer and use it in GitHub Desktop.

Revisions

  1. josecarlospsh renamed this gist Jul 29, 2020. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. josecarlospsh created this gist Jul 29, 2020.
    10 changes: 10 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    <?php
    function get_page_id_by_slug( $page_slug ) {
    $page = get_page_by_path( $page_slug );
    if ( $page ) {
    return $page->ID;
    } else {
    return null;
    }
    }
    ?>