debug.log
[25-Mar-2024 16:34:44 UTC] PHP Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in ../wp-includes/formatting.php on line 4813
Reason is tag_escape()
call with null
as parameter in list-category-posts/include/lcp-catlistdisplayer.php
line 264:
$tag = tag_escape($this->params['title_tag']) ?: tag_escape($tag);
List category posts 0.89.8, WordPress 6.4.3, PHP 8.1.x
]]>debug.log
when installing Elementor:
[06-Jan-2024 12:59:16 UTC] PHP Deprecated: Function print_emoji_styles is deprecated since version 6.4.0! Use wp_enqueue_emoji_styles instead. in ../wp-includes/functions.php on line 6031
[06-Jan-2024 12:59:16 UTC] PHP Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in ../wp-content/plugins/elementor/core/experiments/manager.php on line 161
Elementor 3.18.3, Hello Elementor 3.0.0, WordPress 6.4.1, PHP 8.1.x
]]>Can you fix this PHP warning, or explain why it is happening:PHP Warning: preg_replace(): Unknown modifier 'n'
Im trying to edit some post content globally on all posts, that changes some text using regex to display twitter post from other data.
I tried ALOT of ways to do this, but nothing worked.
Wrote a small plugin for this, just simple one with this code:
function twitter_filter_content( $text )
{
if ( is_singular() && in_the_loop() && is_main_query() )
{
$text = preg_replace('/<blockquote class="twitter-tweet".*<a href="(.*)">.*<\/a><\/blockquote>/s', '<!-- wp:embed {"url":"${1}","type":"rich","providerNameSlug":"twitter","responsive":true,"className":""} --><figure class="wp-block-embed is-type-rich is-provider-twitter wp-block-embed-twitter"><div class="wp-block-embed__wrapper">${1}</div></figure><!-- /wp:embed -->', $text);
}
return $text;
}
add_filter( 'the_content', 'twitter_filter_content', 1);
This preg_replace code should work and been tested at regex101.com and online-free-tools.com/en/php_preg_replace_test_pattern and should be working, atleast there, but its not working on the site, my guess is, its looking at the html output code after render and that will never work.
It need to change the post source text BEFORE wordpress changes to html post.
Anyone knows a trick?
Thanks.
]]>My name is Nikita and I’m a lead developer of the Ultimate Member plugin.
Our customer has an issue when inserting the user profile shortcode via Elementor page editor.
We are using data attribute for image uploader fields in shortcode and it looks like:
<div data-allowed_types="gif,jpg,jpeg,png">{some uploader HTML here}</div>
WP native editor works fine. But with Elementor I see this replaced HTML:
<div data-allowed_types="gif,jpg,jpeg.png">{some uploader HTML here}</div>
var_dump( $allowed_types ) returns the proper string “gif,jpg,jpeg,png” the same time
So I guess there are some preg_replace or str_replace functionality.
Please let me know the place where I may disable this or it’s some bug at your side.
Let me know,
Thanks!
Warning: preg_replace(): Compilation failed: escape sequence is invalid in character class at offset 4 in (…)/wp-content/plugins/so-css/so-css.php on line 756
It appears several times in a row above the display of the website, pushing it down. As far as I see it the editor works normally, though.
The PHP version used on the websites is 7.4.5, on a website with some version of 7.3 the error does not appear.
]]>What I’d like to do is modify the content of the posts before they’re added to the feed. I’ve done a fair bit of reading, and it seems it should be possible … but I’m not a programmer by trade, so I’m muddling a bit and could use some help. (I do know my way around the WP code base, and have written a couple simple shortcode plugins, plus some PHP scripts, so I’m not totally in the dark.)
I think I need to create a custom feed (or many, one for each feed type?), and massage the content before it’s added to the feed. I think I can do what I need with a fairly straightforward preg_replace, as the spoiler sections are clearly marked with this HTML…
<div class="spoiler-wrap"><div class="spoiler-head no-icon collapsed" title="Expand">Spoiler</div><div class="spoiler-body" style="display: none;">This is the spoiler text I'd like to remove</div><noscript><div class="spoiler-body">
I can find that bit easily with a regex, and use preg_replace to insert something like “Spoiler hidden—view on the site to reveal.” But that’s as far as I’ve gotten; my questions are…
1) Is this actually possible?
2) If it is possible, what do I need to do?
3) A post can have multiple spoiler tags, so I’d need to catch all of them, so I think some sort of loop around the preg_replace would be needed.
Thanks in advance for any help!
-rob.
]]>Maximum exection time of 30 seconds exceeded in /PATH/lcp-catlist.php on line342.
This line contains a preg_replace() call, and my understanding is that this function is quite expensive.
I’m not sure what this line does, but when I removed the entire containing IF statement, the plugin now FLIES and I can’t see any real difference with the output in my particular configuration.
Is the preg_replace() necessary, or might it be possible to achieve the same outcome with a less expensive function?
Thanks for a great plugin that I use extensively!
]]>Here’s what we have to replace the deprecated preg_replace function:
$result = preg_replace_callback(
"'\[swf:(.*?)\]'",
function($matches) {
return stripslashes(wpFlashParseMacro($matches[1]));
}
,
$content
);
return $result;
]]>i am reporting a bug and providing a fix just in case anyone else runs into this issue.
behavior: any link with the web address ending with w.org like (somethinglaw.org, thisishow.org) gets rewritten like this (somethingl.w.org, thisish.w.org)
problem: the problem is line number 80
$buffer = preg_replace(array('|https://(.*?).w.org|','|https://(.*?).w.org|'), '//$1.w.org', $buffer);
the fix: the regular expression should account for the .
being treated as a wildcard and so should change to \.
$buffer = preg_replace(array('|https://(.*?)\.w.org|','|https://(.*?)\.w.org|'), '//$1.w.org', $buffer);
demonstrating the issue
https://fileserver.imagebucket.net/img/k7jzj24gr7dvcnxolvofldywvk5lxysgkbtzamlole/https-broken.PNG
testing the fix
https://fileserver.imagebucket.net/img/k7jzh24gr6ca26ppiaofjbk36t3akpmgkesgama5ei/https-fixed.PNG
here is a good tutorial about the regex special characters https://www.regular-expressions.info/characters.html
here is a good tool to test your regex https://www.functions-online.com/preg_replace.html
my personal opinion: by far this is the best plugin out there that deals with mixed-content.
hope this helps!
]]>