] = 'on';
}
if ( in_array( $post_type, [ 'attachment', 'web-story' ], true ) ) {
$sitemap[ 'pt_' . $post_type . '_sitemap' ] = 'off';
$titles[ 'pt_' . $post_type . '_add_meta_box' ] = 'off';
continue;
}
$sitemap[ 'pt_' . $post_type . '_sitemap' ] = 'on';
$titles[ 'pt_' . $post_type . '_ls_use_fk' ] = 'titles';
$titles[ 'pt_' . $post_type . '_add_meta_box' ] = 'on';
$titles[ 'pt_' . $post_type . '_bulk_editing' ] = 'editing';
$titles[ 'pt_' . $post_type . '_link_suggestions' ] = 'on';
// Primary Taxonomy.
$taxonomy_hash = [
'post' => 'category',
'product' => 'product_cat',
];
if ( isset( $taxonomy_hash[ $post_type ] ) ) {
$titles[ 'pt_' . $post_type . '_primary_taxonomy' ] = $taxonomy_hash[ $post_type ];
}
}
}
/**
* Get robots default for post type.
*
* @param string $post_type Post type.
* @return array
*/
private function get_post_type_defaults( $post_type ) {
$rich_snippets = [
'post' => 'article',
'page' => 'article',
'product' => 'product',
'download' => 'product',
'web-story' => 'article',
];
$defaults = [
'robots' => [],
'is_custom' => 'off',
'rich_snippet' => isset( $rich_snippets[ $post_type ] ) ? $rich_snippets[ $post_type ] : 'off',
'article_type' => 'post' === $post_type ? 'BlogPosting' : 'Article',
];
if ( 'attachment' === $post_type ) {
$defaults['is_custom'] = 'on';
$defaults['robots'] = [ 'noindex' ];
}
return $defaults;
}
/**
* Check post type has archive.
*
* @param string $post_type Post type.
* @return bool
*/
private function has_archive( $post_type ) {
$post_type_obj = get_post_type_object( $post_type );
return ! is_null( $post_type_obj ) && $post_type_obj->has_archive;
}
/**
* Create post type options.
*
* @param array $titles Hold title settings.
* @param array $sitemap Hold sitemap settings.
*/
private function create_taxonomy_options( &$titles, &$sitemap ) {
$taxonomies = Helper::get_accessible_taxonomies();
foreach ( $taxonomies as $taxonomy => $object ) {
$defaults = $this->get_taxonomy_defaults( $taxonomy );
$titles[ 'tax_' . $taxonomy . '_title' ] = '%term% %sep% %sitename%';
$titles[ 'tax_' . $taxonomy . '_robots' ] = $defaults['robots'];
$titles[ 'tax_' . $taxonomy . '_add_meta_box' ] = $defaults['metabox'];
$titles[ 'tax_' . $taxonomy . '_custom_robots' ] = $defaults['is_custom'];
$titles[ 'tax_' . $taxonomy . '_description' ] = '%term_description%';
$titles[ 'tax_' . $taxonomy . '_slack_enhanced_sharing' ] = 'on';
$sitemap[ 'tax_' . $taxonomy . '_sitemap' ] = 'category' === $taxonomy ? 'on' : 'off';
if ( substr( $taxonomy, 0, 3 ) === 'pa_' ) {
$titles[ 'remove_' . $taxonomy . '_snippet_data' ] = 'on';
}
}
$titles['remove_product_cat_snippet_data'] = 'on';
$titles['remove_product_tag_snippet_data'] = 'on';
}
/**
* Get robots default for post type.
*
* @param string $taxonomy Taxonomy.
* @return array
*/
private function get_taxonomy_defaults( $taxonomy ) {
$defaults = [
'robots' => [],
'is_custom' => 'off',
'metabox' => 'category' === $taxonomy ? 'on' : 'off',
];
if ( in_array( $taxonomy, [ 'post_tag', 'post_format', 'product_tag' ], true ) ) {
$defaults['is_custom'] = 'on';
$defaults['robots'] = [ 'noindex' ];
}
return $defaults;
}
/**
* Create capabilities.
*/
private function set_capabilities() {
$admin = get_role( 'administrator' );
if ( ! is_null( $admin ) ) {
$admin->add_cap( 'rank_math_edit_htaccess', true );
}
Capability_Manager::get()->create_capabilities();
}
/**
* Create cron jobs.
*/
public function create_cron_jobs() {
$midnight = strtotime( 'tomorrow midnight' );
foreach ( $this->get_cron_jobs() as $job => $recurrence ) {
if ( ! wp_next_scheduled( "rank_math/{$job}" ) ) {
$timestamp = 'content-ai/update_prompts' === $job ? $midnight + wp_rand( 60, 86400 ) : $midnight;
wp_schedule_event( $timestamp, $this->do_filter( "{$job}_recurrence", $recurrence ), "rank_math/{$job}" );
}
}
}
/**
* Remove cron jobs.
*/
private function remove_cron_jobs() {
foreach ( $this->get_cron_jobs() as $job => $recurrence ) {
wp_clear_scheduled_hook( "rank_math/{$job}" );
}
}
/**
* Get cron jobs.
*
* @return array
*/
private function get_cron_jobs() {
return [
'redirection/clean_trashed' => 'daily', // Add cron for cleaning trashed redirects.
'links/internal_links' => 'daily', // Add cron for counting links.
'content-ai/update_prompts' => 'daily', // Add cron for updating the prompts data.
];
}
/**
* Get opening hours.
*
* @return array
*/
private function get_opening_hours() {
$hours = [];
$days = [ 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday' ];
foreach ( $days as $day ) {
$hours[] = [
'day' => $day,
'time' => '09:00-17:00',
];
}
return $hours;
}
/**
* Get roles to exclude.
*
* @return array
*/
private function get_excluded_roles() {
$roles = Helper::get_roles();
unset( $roles['administrator'], $roles['editor'], $roles['author'] );
return $roles;
}
/**
* Clear rewrite rules.
*
* @param bool $activate True for plugin activation, false for de-activation.
*/
private function clear_rewrite_rules( $activate ) {
if ( is_multisite() && ms_is_switched() ) {
delete_option( 'rewrite_rules' );
Helper::schedule_flush_rewrite();
return;
}
// On activation.
if ( $activate ) {
Helper::schedule_flush_rewrite();
return;
}
// On deactivation.
add_action( 'shutdown', 'flush_rewrite_rules' );
}
/**
* Add defaults for the Instant Indexing module options.
*
* @return void
*/
private function create_instant_indexing_options() {
add_option(
'rank-math-options-instant-indexing',
$this->do_filter(
'settings/defaults/instant-indexing',
[
'bing_post_types' => [ 'post', 'page' ],
]
)
);
}
}
Fatal error: Uncaught Error: Class 'RankMath\Installer' not found in /home/rahjooian/public_html/wp-content/plugins/seo-by-rank-math/rank-math.php:276
Stack trace:
#0 /home/rahjooian/public_html/wp-content/plugins/seo-by-rank-math/rank-math.php(185): RankMath->instantiate()
#1 /home/rahjooian/public_html/wp-content/plugins/seo-by-rank-math/rank-math.php(164): RankMath->setup()
#2 /home/rahjooian/public_html/wp-content/plugins/seo-by-rank-math/rank-math.php(554): RankMath::get()
#3 /home/rahjooian/public_html/wp-content/plugins/seo-by-rank-math/rank-math.php(558): rank_math()
#4 /home/rahjooian/public_html/wp-settings.php(473): include_once('/home/rahjooian...')
#5 /home/rahjooian/public_html/wp-config.php(168): require_once('/home/rahjooian...')
#6 /home/rahjooian/public_html/wp-load.php(50): require_once('/home/rahjooian...')
#7 /home/rahjooian/public_html/wp-blog-header.php(13): require_once('/home/rahjooian...')
#8 /home/rahjooian/public_html/index.php(17): require('/home/rahjooian...')
#9 {main}
thrown in /home/rahjooian/public_html/wp-content/plugins/seo-by-rank-math/rank-math.php on line 276