Files
piratepoet/lib/WP/Posts.php
Jan Jakeš b39dac75d6 Autofix number of newlines between methods
[MAILPOET-2715]
2020-02-19 19:12:53 +00:00

28 lines
825 B
PHP

<?php
namespace MailPoet\WP;
use MailPoet\WP\Functions as WPFunctions;
class Posts {
public 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);
}
}
public 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);
}
}