-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
A lot of the constants are not actually even constant:
define('KBE_ARTICLE_QTY', get_option('kbe_article_qty'));
define('KBE_PLUGIN_SLUG', get_option('kbe_plugin_slug'));
define('KBE_SEARCH_SETTING', get_option('kbe_search_setting'));
define('KBE_BREADCRUMBS_SETTING', get_option('kbe_breadcrumbs_setting'));
define('KBE_SIDEBAR_HOME', get_option('kbe_sidebar_home'));
define('KBE_SIDEBAR_INNER', get_option('kbe_sidebar_inner'));
define('KBE_COMMENT_SETTING', get_option('kbe_comments_setting'));
define('KBE_BG_COLOR', get_option('kbe_bgcolor'));
define('KBE_LINK_STRUCTURE', get_option('permalink_structure'));
You're running these get_option() calls (which probably aren't that expensive) on every page load whether the results are needed or not.
Worse, there's running this SQL query on every load. This definitely needs to go in an option, which will help the permalinks options a lot.
//=========> Get Knowledgebase title
global $wpdb;
$getSql = $wpdb->get_results("Select ID From $wpdb->posts Where post_content Like '%[kbe_knowledgebase]%' And post_type <> 'revision'");
foreach($getSql as $getRow) {
$pageId = $getRow->ID;
}
define('KBE_PAGE_TITLE', $pageId);
Metadata
Metadata
Assignees
Labels
No labels