kn007
Forum Replies Created
-
Thank you, @keesiemeijer
Found the problem, my header.php using like
$content = apply_filters('the_content', $content);
for html description meta tag.Now it’s ok.
Thanks a lot.
Thank you.
I will check it later.
A lot of filters to apply for the content.
Emmm, when i using the default Twenty Seventeen theme, it was working fine.
But my theme do not using any ob_*, when i let all of plugins deactivated, still have the issue.Any idea for this?
Thanks a lot.
I will track it on local later.
Hi keesiemeijer.
I have a problem here. It seems WordPress will do shortcode twice times?
If I call 3 times same shortcode on my post content. It will do the shortcode 6 times. The first 3 times like wordpress just doing the shortcode and will not print html, last 3 times will print html.
When I using like your code on wordpress 4.8.2:
function my_content_shortcode( $atts, $content = null ) { static $count = 0; $count++; return '<span class="shortcode-count">My Shortcode ' . $count . '</span>'; } add_shortcode( 'my_content', 'my_content_shortcode' );The post content:
No.1 [my_content][/my_content] No.2 [my_content][/my_content] No.3 [my_content][/my_content]And the post show
No.1 My Shortcode 4 No.2 My Shortcode 5 No.3 My Shortcode 6Like the first N times to run the global, and then run N times to output. (N equal same shortcode was called)
How can i solve it?
Thank you.
- This reply was modified 8 years, 7 months ago by kn007.
Forum: Fixing WordPress
In reply to: _prime_comment_caches() is using too much memoryWTF, when i do this, my site only can see the parent(=0) comments, the children comments cannot see.
why!?
Forum: Fixing WordPress
In reply to: _prime_comment_caches() is using too much memoryok, i found.
./wp-includes/ms-blogs.php:659: wp_cache_add_non_persistent_groups( array( ‘comment’, ‘counts’, ‘plugins’ ) );
./wp-includes/ms-blogs.php:730: wp_cache_add_non_persistent_groups( array( ‘comment’, ‘counts’, ‘plugins’ ) );
./wp-includes/load.php:477: wp_cache_add_non_persistent_groups( array( ‘comment’, ‘counts’, ‘plugins’ ) );
i change to
wp_cache_add_non_persistent_groups( array( 'counts', 'plugins' ) );it ‘s work, now:
Had 12 queries in 0.0158 seconds, page to load in 7.716 seconds, using 52.34MB memory.all right, memory using still large, but less queries.
any idea to optimize the memory?
Forum: Fixing WordPress
In reply to: _prime_comment_caches() is using too much memoryi saw the wordpress define $no_mc_groups
[“no_mc_groups”]=>
array(3) {
[0]=>
string(7) “comment”
[1]=>
string(6) “counts”
[2]=>
string(7) “plugins”
}but i cannot find the code to define this. Where is it?
Forum: Fixing WordPress
In reply to: _prime_comment_caches() is using too much memorymaybe it’s add_to_internal_cache?
i will check later
Forum: Fixing WordPress
In reply to: _prime_comment_caches() is using too much memoryi test this follow code in memcache/redis obj-cache :
`
<?php var_dump(wp_cache_add(‘test’, ‘test’, ‘comment’));?>
<?php var_dump(wp_cache_get(‘test’, ‘comment’));?>
<?php var_dump(wp_cache_set(‘test’, ‘test’, ‘comment’));?>
<?php var_dump(wp_cache_get(‘test’, ‘comment’));?>
`
return
bool(true)
string(4) “test”
bool(true)
string(4) “test”but it could not find in memcache/redis.
so, how it work when the group is comment?
Forum: Fixing WordPress
In reply to: _prime_comment_caches() is using too much memoryok, i found the another problem, when i open home page(or another only had main loop pages).
all comment of the page can using wp_cache_get get the ids, but Memcached::Get() get the ids false!?
why?
recently, i post the another question about $in_comment_loop do not working(always return null) after using wp_list_comments!?
i hope fix it as quickly as possible.
Forum: Fixing WordPress
In reply to: _prime_comment_caches() is using too much memoryAnyone here?
the problem is the memcache group bypass to set.
i change the
wp_cache_add($comment->comment_ID, $comment, 'comment');
to
wp_cache_add($comment->comment_ID, $comment, 'comments');it’s work, memcache can set&get all the value, but if want to change all the comment group was so confusing.
so, any idea to fix it?
i check the object-cache.php, $no_mc_groups was a empty array.
i add ‘comment’ to $global_groups, but it’s still not work.
Forum: Fixing WordPress
In reply to: _prime_comment_caches() is using too much memoryActually _prime_comment_caches() do Memcached::Set 35,000+ time in first time.
update_comment_cache() do Memcached::Set 17,000+ time.
update_meta_cache() do Memcached::Set 17,000+ time.update_meta_cache() was successful, but all of keys value was same value(a:0:{}) because my site did not had any comment meta.
Forum: Fixing WordPress
In reply to: _prime_comment_caches() is using too much memoryI don’t know what to say.
I found the problem in wp-includes/comment.php #L2490:
wp_cache_add($comment->comment_ID, $comment, 'comment');The data($comment) could not be set to memcache.
Maybe need apply some filters like update_option()?
Thank you.
Forum: Themes and Templates
In reply to: Comment pagination not working after updating to WordPress 4.4?Ahother question:$in_comment_loop do not working(still return empty and false) after using wp_list_comments!?
Forum: Themes and Templates
In reply to: Comment pagination not working after updating to WordPress 4.4?But the #1 code is working in wordpress version < 4.4, so maybe something change in wordpress 4.4 to get this issue.
Can someone tell me why?
Thank you.