On some slow host, the `newsletter` table get filled with duplicated `notification_history` marked as `sending` that never get sent. To prevent this we've made the two following changes: * We prevent firing `publis_*` hooks on post_type which are excluded from search. * We do not schedule a new post notification email if one has an `notification_history` entry marked as `sending`. [MAILPOET-1371]
27 lines
702 B
PHP
27 lines
702 B
PHP
<?php
|
|
namespace MailPoet\WP;
|
|
|
|
class Posts {
|
|
|
|
static function getTerms($args) {
|
|
// Since WordPress 4.5.0 signature of get_terms changed to require
|
|
// one argument array, where taxonomy is key of that array
|
|
if(version_compare(get_bloginfo('version'), '4.5.0', '>=')) {
|
|
return get_terms($args);
|
|
} else {
|
|
$taxonomy = $args['taxonomy'];
|
|
unset($args['taxonomy']);
|
|
return get_terms($taxonomy, $args);
|
|
}
|
|
}
|
|
|
|
static function getTypes($args = array(), $output = 'names', $operator = 'and') {
|
|
$defaults = array(
|
|
'exclude_from_search' => false
|
|
);
|
|
$args = array_merge($defaults, $args);
|
|
return get_post_types($args, $output, $operator);
|
|
}
|
|
|
|
}
|