WPML – PHP Fatal error: Uncaught Error: Call to undefined function str_contains()

To fix it urgently, I had to put a str_contains() polyfill right into wp-config.php: if (!function_exists(‘str_contains’)) { /** * Check if substring is contained in string * * @param $haystack * @param $needle * * @return bool */ function str_contains($haystack, $needle) { return (strpos($haystack, $needle) !== false); } } I used the polyfill from gdarko … Read more

Conflicting plugins break site

Try debug to see the error: https://wordpress.org/documentation/article/debugging-in-wordpress/. Check also wp-content/debug.log or any other configured log files for exact error. If the site is not working (blank page), disable plugins (just rename the plugins folder to “_plugins”). If you know which plugin is problematic go to plugins folder and rename the folder plugin: (plugins/_the_plugin). At least … Read more

Display Rank Math Meta description at the beginning of single post

Option 1 If you want to inject the Rank Math meta description into the post content using the the_content filter, you can do so by adding a filter to your theme’s functions.php file. Here’s how you can achieve that: function inject_rank_math_description($content) { if (is_single() && !is_admin()) { // Check if Rank Math meta description exists … Read more

PHP – Unexpected character in input: ” (ASCII=20) state=0

In your code, you’re doing this: $template_file_name = require_once ( get_template_directory() . ‘/template.docx’ ); …but that’s not how require_once (or require) works. require_once will load the file (or throw a warning if the file can’t be included, eg, bad permissions or the file doesn’t exist), but it will not return the filename; it will, instead, … Read more

How to display WordPress Twenty Twenty-Four’s built-in custom field in a post (or page)?

WordPress’s Twenty Twenty-Four theme makes it possible to add custom fields directly in the editor This UI is not coming from TwentyTwentyFour, and was added to WP decades ago: https://wordpress.org/documentation/article/assign-custom-fields/ It predates 2024/2023 and was even present when the original Kubrick theme was the default theme, this is because it’s a part of WordPress itself. … Read more

stop resize button for wordpress media

That’s a bit tricky because WordPress doesn’t offer this functionality out of the box. But a workaround would be to stop WordPress from generating additional image sizes for uploaded images. But it will apply to all image uploads, not just those in the WooCommerce product gallery. If you wanted to try it out, here’s the … Read more

Cronjobs at night – but not the rest of the day

To achieve the behavior you’re describing in WordPress, where a cron job runs hourly but only between 2 AM and 5 AM, you have a couple of options. While WordPress doesn’t offer this level of specificity in its default scheduling, you can customize it to suit your needs. Custom Cron Scheduling: This involves creating a … Read more