Collection of wp-cubi functions for WordPress
- PHP 8.0, 8.1 or 8.2
composer require globalis/wp-cubi-helpers
flush_cache_all()
flush_cache_wpdb()
flush_cache_object()
get_size_cache_wpdb(): int
get_size_cache_object(): int
reset_cache_wpdb(int $size)
reset_cache_object(int $size)
pop_cache_wpdb()
pop_cache_object()
savequeries_enabled(): bool
mysql_enable_nocache_mod()
mysql_disable_nocache_mod()
query_set_nocache(string $query): string
time_start(string $timer = 'default'): float
time_elapsed(string $timer = 'default', bool $human = true)
memory_get_usage_kb(bool $human = true, bool $real_usage = false)
memory_get_usage_mb(bool $human = true, bool $real_usage = false)
memory_get_peak_usage_kb(bool $human = true, bool $real_usage = false)
memory_get_peak_usage_mb(bool $human = true, bool $real_usage = false)
memory_usage_format(float $usage, string $unit, bool $human)
add_filter(string $tag, callable $function_to_add, int $priority = 10, int $accepted_args = 1)
add_action(string $tag, callable $function_to_add, int $priority = 10, int $accepted_args = 1)
remove_filter_anonymous_object(string $tag, string $class_name, string $method_name, int $priority = 10): bool
wp_mail_html($to, string $subject, string $message, $headers = [], $attachments = []): bool
get_permalink_by_template(string $template, $default = false)
include_template_part($file, $data = [], $return = false)
get_current_url(bool $remove_query_args = false): string
current_url_starts_with(string $search, bool $remove_query_args = false): bool
current_url_ends_with(string $search, bool $remove_query_args = false): bool
str_starts_with(string $string, string $search): bool
str_ends_with(string $string, string $search): bool
trigger_404(\WP_Query $query = null)
override_php_limits(int $time_limit = 604800, string $memory_limit = '512M')
Before opening pull requests, please check and apply project coding standards with ./vendor/bin/phpcs .
and/or ./vendor/bin/phpcbf .