case 'attachment':
if ( ! $this->isInvalidAttachment( $post ) ) {
$remainingPosts[] = $post;
}
break;
default:
$remainingPosts[] = $post;
break;
}
}
return $remainingPosts;
}
/**
* Excludes attachments if their post parent isn't published or parent post type isn't registered anymore.
*
* @since 4.0.0
*
* @param Object $post The post.
* @return boolean Whether the attachment is invalid.
*/
private function isInvalidAttachment( $post ) {
if ( empty( $post->post_parent ) ) {
return false;
}
$parent = get_post( $post->post_parent );
if ( ! is_object( $parent ) ) {
return false;
}
if (
'publish' !== $parent->post_status ||
! in_array( $parent->post_type, get_post_types(), true ) ||
$parent->post_password
) {
return true;
}
return false;
}
/**
* Returns all eligble sitemap entries for a given taxonomy.
*
* @since 4.0.0
*
* @param string $taxonomy The taxonomy.
* @param array $additionalArgs Any additional arguments for the term query.
* @return array|int The term objects or the term count.
*/
public function terms( $taxonomy, $additionalArgs = [] ) {
// Set defaults.
$fields = 't.term_id';
$offset = aioseo()->sitemap->offset;
// Override defaults if passed as additional arg.
foreach ( $additionalArgs as $name => $value ) {
$$name = esc_sql( $value );
if ( 'root' === $name && $value ) {
$fields = 't.term_id';
}
if ( 'count' === $name && $value ) {
$fields = 'count(t.term_id) as total';
}
}
$termRelationshipsTable = aioseo()->core->db->db->prefix . 'term_relationships';
$termTaxonomyTable = aioseo()->core->db->db->prefix . 'term_taxonomy';
$query = aioseo()->core->db
->start( aioseo()->core->db->db->terms . ' as t', true )
->select( $fields )
->whereRaw( "
( `t`.`term_id` IN
(
SELECT `tt`.`term_id`
FROM `$termTaxonomyTable` as tt
WHERE `tt`.`taxonomy` = '$taxonomy'
AND `tt`.`count` > 0
)
)" );
$excludedTerms = aioseo()->sitemap->helpers->excludedTerms();
if ( $excludedTerms ) {
$query->whereRaw("
( `t`.`term_id` NOT IN
(
SELECT `tr`.`term_taxonomy_id`
FROM `$termRelationshipsTable` as tr
WHERE `tr`.`term_taxonomy_id` IN ( $excludedTerms )
)
)" );
}
if (
aioseo()->sitemap->indexes &&
empty( $additionalArgs['root'] ) &&
( empty( $additionalArgs['count'] ) || ! $additionalArgs['count'] )
) {
$query->limit( aioseo()->sitemap->linksPerIndex, $offset );
}
// Return the total if we are just counting the terms.
if ( ! empty( $additionalArgs['count'] ) && $additionalArgs['count'] ) {
return (int) $query->run( true, 'var' )
->result();
}
$terms = $query->orderBy( '`t`.`term_id` ASC' )
->run()
->result();
foreach ( $terms as $term ) {
// Convert ID from string to int.
$term->term_id = (int) $term->term_id;
// Add taxonomy name to object manually instead of querying it to prevent redundant join.
$term->taxonomy = $taxonomy;
}
return $terms;
}
/**
* Wipes all data and forces the plugin to rescan the site for images.
*
* @since 4.0.13
*
* @return void
*/
public function resetImages() {
aioseo()->core->db
->update( 'aioseo_posts' )
->set(
[
'images' => null,
'image_scan_date' => null
]
)
->run();
}
}
Fatal error: Uncaught Error: Class "AIOSEO\Plugin\Common\Sitemap\Query" not found in /home/valigeria/public_html/wp-content/plugins/all-in-one-seo-pack-pro/app/Pro/Sitemap/Query.php:16
Stack trace:
#0 /home/valigeria/public_html/wp-content/plugins/all-in-one-seo-pack-pro/vendor/composer/ClassLoader.php(576): include()
#1 /home/valigeria/public_html/wp-content/plugins/all-in-one-seo-pack-pro/vendor/composer/ClassLoader.php(427): Composer\Autoload\{closure}('/home/valigeria...')
#2 /home/valigeria/public_html/wp-content/plugins/all-in-one-seo-pack-pro/app/Pro/Sitemap/Sitemap.php(33): Composer\Autoload\ClassLoader->loadClass('AIOSEO\\Plugin\\P...')
#3 /home/valigeria/public_html/wp-content/plugins/all-in-one-seo-pack-pro/app/AIOSEO.php(311): AIOSEO\Plugin\Pro\Sitemap\Sitemap->__construct()
#4 /home/valigeria/public_html/wp-content/plugins/all-in-one-seo-pack-pro/app/AIOSEO.php(97): AIOSEO\Plugin\AIOSEO->load()
#5 /home/valigeria/public_html/wp-content/plugins/all-in-one-seo-pack-pro/app/AIOSEO.php(76): AIOSEO\Plugin\AIOSEO->init()
#6 /home/valigeria/public_html/wp-content/plugins/all-in-one-seo-pack-pro/app/AIOSEO.php(414): AIOSEO\Plugin\AIOSEO::instance()
#7 /home/valigeria/public_html/wp-content/plugins/all-in-one-seo-pack-pro/all_in_one_seo_pack.php(96): aioseo()
#8 /home/valigeria/public_html/wp-settings.php(517): include_once('/home/valigeria...')
#9 /home/valigeria/public_html/wp-config.php(111): require_once('/home/valigeria...')
#10 /home/valigeria/public_html/wp-load.php(50): require_once('/home/valigeria...')
#11 /home/valigeria/public_html/wp-blog-header.php(13): require_once('/home/valigeria...')
#12 /home/valigeria/public_html/index.php(17): require('/home/valigeria...')
#13 {main}
thrown in /home/valigeria/public_html/wp-content/plugins/all-in-one-seo-pack-pro/app/Pro/Sitemap/Query.php on line 16