ap_base_page_slug()

Description #

Get slug of base page.

Changelog #

VersionDescription
4.1.6Make sure always questions is returned if no base page is set.
3.0.0Return questions if base page is not selected.
2.0.0Introduced.

Source #

File: includes/functions.php

function ap_base_page_slug() {
	$slug = 'questions';

	if ( ! empty( ap_opt( 'base_page' ) ) ) {
		$base_page = get_post( ap_opt( 'base_page' ) );

		if ( $base_page ) {
			$slug = $base_page->post_name;

			if ( $base_page->post_parent > 0 ) {
				$parent_page = get_post( $base_page->post_parent );
				$slug        = $parent_page->post_name . '/' . $slug;
			}
		}
	}

	return apply_filters( 'ap_base_page_slug', $slug );
}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment