Files
piratepoet/lib/WP/Posts.php
Jan Jakeš 1b5b9d89ff Autofix namespace declaration spacing
[MAILPOET-2409]
2019-10-01 14:29:30 +01:00

30 lines
813 B
PHP

<?php
namespace MailPoet\WP;
use MailPoet\WP\Functions as WPFunctions;
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(WPFunctions::get()->getBloginfo('version'), '4.5.0', '>=')) {
return WPFunctions::get()->getTerms($args);
} else {
$taxonomy = $args['taxonomy'];
unset($args['taxonomy']);
return WPFunctions::get()->getTerms($taxonomy, $args);
}
}
static function getTypes($args = [], $output = 'names', $operator = 'and') {
$defaults = [
'exclude_from_search' => false,
];
$args = array_merge($defaults, $args);
return WPFunctions::get()->getPostTypes($args, $output, $operator);
}
}