Admin pages (e.g. in a custom plugin) may see $post as undefined. The existing usage to get permalinks for these pages can fill debug logs with PHP Notices.
if ($config->userFrameworkFrontend) {
global $post;
if (get_option('permalink_structure') != '') {
- $script = get_permalink($post->ID);
+ $script = $post ? get_permalink($post->ID) : "";
}
- if ($config->wpBasePage == $post->post_name) {
+ if ($post && $config->wpBasePage == $post->post_name) {
$basepage = TRUE;
}
// when shortcode is included in page