xu wu
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: the_content loading=”lazy”Today I compared several different template files, and then I added the following code before the the_content() function. Now the images are correctly assigned the lazy and auto attributes. The strange problem is solved.
<?php
get_header();
//add code
global $post;
if ( have_posts() ) {
while (have_posts())
{
the_post();
}
}
//add code
the_content();Forum: Fixing WordPress
In reply to: the_content loading=”lazy”Most articles have multiple photos, such as my resources article. If it is the first photo, it will be marked with <img fetchpriority=”high” and will not add a lazy tag. The subsequent pictures will be added with lazy normally.
In addition, I query the source code and auto size is added on the basis of lazy. Only with lazy can auto size;
My instruments article is a really weird question, if I find anything new useful information, I will paste it here to share, and thank you for your help!Forum: Fixing WordPress
In reply to: the_content loading=”lazy”I checked my theme files, and there is no code as you mentioned. Moreover, I printed all the filters and actions in the backend using the code and found the following relevant items.
filter,Priority, path, status
Filter NAME,Priority, path, status
the_content,8,apply_block_hooks_to_content_from_post_object,/www/wwwroot/www.XXXX.com/wp-includes/blocks.php:1191,TRUE
the_content,8,WP_Embed->run_shortcode,/www/wwwroot/www.XXXX.com/wp-includes/class-wp-embed.php:62,TRUE
the_content,8,WP_Embed->autoembed,/www/wwwroot/www.XXXX.com/wp-includes/class-wp-embed.php:442,TRUE
the_content,9,do_blocks,/www/wwwroot/www.XXXX.com/wp-includes/blocks.php:2405,TRUE
the_content,10,wptexturize,/www/wwwroot/www.XXXX.com/wp-includes/formatting.php:37,TRUE
the_content,10,wpautop,/www/wwwroot/www.XXXX.com/wp-includes/formatting.php:446,TRUE
the_content,10,shortcode_unautop,/www/wwwroot/www.XXXX.com/wp-includes/formatting.php:824,TRUE
the_content,10,prepend_attachment,/www/wwwroot/www.XXXX.com/wp-includes/post-template.php:1723,TRUE
the_content,10,wp_replace_insecure_home_url,/www/wwwroot/www.XXXX.com/wp-includes/https-migration.php:51,TRUE
the_content,10,RankMath\Frontend_SEO_Score->insert_score,/www/wwwroot/www.XXXX.com/wp-content/plugins/seo-by-rank-math/includes/class-frontend-seo-score.php:69,TRUE
the_content,10,wrap_tables_with_div,/www/wwwroot/www.XXXX.com/wp-content/themes/XXXXX/functions.php:571,TRUE
the_content,11,capital_P_dangit,/www/wwwroot/www.XXXX.com/wp-includes/formatting.php:5681,TRUE
the_content,11,do_shortcode,/www/wwwroot/www.XXXX.com/wp-includes/shortcodes.php:243,TRUE
the_content,12,wp_filter_content_tags,/www/wwwroot/www.XXXX.com/wp-includes/media.php:1866,TRUE
the_content,20,convert_smilies,/www/wwwroot/www.XXXX.com/wp-includes/formatting.php:3474,TRUE
the_content,1000,TRP_Translation_Render->wrap_with_post_id,/www/wwwroot/www.XXXX.com/wp-content/plugins/translatepress-multilingual/includes/class-translation-render.php:2145,TRUE
acf_the_content,10,wp_filter_content_tags/www/wwwroot/www.XXXX.com/wp-includes/media.php:1866,true
acf_the_content,8,WP_Embed->run_shortcode/www/wwwroot/www.XXXX.com/wp-includes/class-wp-embed.php:62,true
acf_the_content,8,WP_Embed->autoembed/www/wwwroot/www.XXXX.com/wp-includes/class-wp-embed.php:442,true
acf_the_content,10,wptexturize/www/wwwroot/www.XXXX.com/wp-includes/formatting.php:37,true
acf_the_content,10,wpautop/www/wwwroot/www.XXXX.com/wp-includes/formatting.php:446,true
acf_the_content,10,shortcode_unautop/www/wwwroot/www.XXXX.com/wp-includes/formatting.php:824,true
acf_the_content,10,wp_filter_content_tags/www/wwwroot/www.XXXX.com/wp-includes/media.php:1866,true
acf_the_content,11,capital_P_dangit/www/wwwroot/www.XXXX.com/wp-includes/formatting.php:5681,true
acf_the_content,11,do_shortcode/www/wwwroot/www.XXXX.com/wp-includes/shortcodes.php:243,true
acf_the_content,20,convert_smilies/www/wwwroot/www.XXXX.com/wp-includes/formatting.php:3474,trueThe only time I operated the_content is the_content,10,wrap_tables_with_div,/www/wwwroot/www.XXXX.com/wp-content/themes/XXXXX/functions.php:571,TRUE, it just modified the display of the table. I also tried to log out of the filter, but nothing good changes.
In addition, the wp_filter_content_tags you mentioned are displayed as true in the_content and ACF_the_content, which is correct, otherwise the article pictures of my two types of articles, resources and news, will not be lazy.Forum: Fixing WordPress
In reply to: the_content loading=”lazy”Thank you for your reply. I added the following code in the single-instruments.php template file.
if(current_user_can('manage_options')) {
echo apply_filters( 'the_content', get_the_content() );
}
?>It output the full text of the article again, but when I checked the images of several articles, their img tags all started with the following code.
instruments post type:
<img decoding="async" aria-describedby="caption-attachment-9814" class="wp-image-9814" src="......sizes="(max-width: 499px) 100vw, 499px">resources post type:
<img loading="lazy" decoding="async" aria-describedby="caption-attachment-9369" class="wp-image-9369" src=".....sizes="auto, (max-width: 683px) 100vw, 683px">Additionally, I found that the images at the end of the code for articles of the resources type have ‘auto’ added, while those for instruments do not.
Forum: Reviews
In reply to: [Autoptimize] How to disable cachingYesterday I refreshed the cache and today I can select the selection and save it. Thank you,You’re a professional.
May I ask what some PHP files in the /wp-content/cache/autoptimize directory do? Because one of my trusted search engines is crawling them and I don’t know what code on the front end of the page is revealing the address of these PHP files./wp-content/cache/autoptimize/autoptimize_d41d8cd98f00b204e9800998ecf8427e.php
/wp-content/cache/autoptimize/autoptimize_d41d8cd98f00b204e9800998ecf8427e.php.none
Forum: Reviews
In reply to: [Autoptimize] How to disable cachingSorry, my description was incorrect.
For example, I selected the option to optimize CSS separately, and then I clicked the save button of the plugin. The page started refreshing, but then the plugin page showed that I had not selected any options. I checked the cache file, but did not see any optimization. The plugin has no error prompts, and the developer tool also has no error messages.Forum: Reviews
In reply to: [Autoptimize] How to disable cachingThanks for your reply, but I’m having a problem now. I deleted the plugin yesterday and now that I reinstalled it I want to try what you said. But after I check some options and click save or save and clear cache, the page refreshes and it says I didn’t check something? I’m not sure what’s happening. There is no error message in the developer tools.
I added the following code to fix it, hopefully it can be of help to anyone experiencing the same problem.
add_action('template_redirect', 'redirect_html_suffix',999);
function redirect_html_suffix() {
// URL
$request_uri = $_SERVER['REQUEST_URI'];
if (preg_match('/(.*?)-html$/', $request_uri, $matches)) {
$new_url = rtrim($matches[1], '/') . '.html';
wp_redirect($new_url, 301);
exit; }
}But I’ve found a new mistake now..
Original link: http://www.test.com/brands/clothes/
Translated link: http://www.test.com/en/brands/clothes-2/When I switch to the translated site and go to the custom-taxonomy-brands page, this brands page will show all my product brands, I noticed that some of the brands have a ‘-2’ character added to their translated links, not all of them, but some of them.
it will 301 jump to http://www.test.com/en/brands/clothes-2/
In version 2.8.2, I used the following code to convert all the URLs ending in html normally, but after updating to 2.8.7…
.html changed to -htmlOriginal link: http://www.test.com/test.html
Translated link: http://www.test.com/en/test-html
With the following code, my sitemap shows the correct URL and the translated URL on all pages of the site, but when I click on it, it will jump from .html 301 to -html.add_filter( 'trp_get_url_for_language', 'trpc_remove_end_slash', 10, 6);
function trpc_remove_end_slash($new_url, $url, $language, $abs_home, $lang_from_url_string, $lang_url_slug){
if (strpos($new_url, '.html') !== false || strpos($new_url, 'sitemap.xml') !== false){
return untrailingslashit($new_url);
}
return $new_url;
}If I don’t use the code above, I’ll see a .html/ ending in my sitemap. After clicking, it will still 301 jump to the end of -html.
I’ve tried turning on the fix option for using older versions in 2.8.7 and downgrading to 2.8.2, but all my translated links are with the above issue. Please help provide me with a useful function, thank you very much!
Forum: Reviews
In reply to: [Zhanzhangb Indexing Submission for Baidu] 挺好, 但是只能提交默认post type.修改下插件就好了啊。
比如你有一个 post type 叫 book,打开插件的zhanzhangb-baidu-submit.php,在page和post下面 增加一行,改下book按你的需要,
每个人的post type不一样,得自己改,,
add_action( 'publish_page', array( $this, 'baidu_submit_post' ), 1 );
add_action( 'publish_post', array( $this, 'baidu_submit_post' ), 1 );
add_action( 'publish_book', array( $this, 'baidu_submit_post' ), 1 );参考学习资料如下:
Forum: Plugins
In reply to: [Image Watermark] active PHP flat errorAlso, please add support for webp image format, thank you for your work.
hello
I used the ACF plugin to create some taxonomy items for my custom post type.
I don’t remember what I did to the category, and your plugin reported an error, is there any way to locate it? Finding a problem with a taxonomy?one new warning
strtolower(): Passing null to parameter #1 ($string) of type string is deprecated
- wp-content/plugins/seo-by-rank-math/includes/settings/titles/taxonomies.php:72
strtolower()
wp-content/plugins/seo-by-rank-math/includes/settings/titles/taxonomies.php:72RankMath\Admin\Options->register_option_page()
wp-includes/class-wp-hook.php:324do_action('cmb2_admin_init')
wp-content/plugins/seo-by-rank-math/vendor/cmb2/cmb2/bootstrap.php:26cmb2_bootstrap()
wp-content/plugins/seo-by-rank-math/vendor/cmb2/cmb2/init.php:165CMB2_Bootstrap_2110->include_cmb()
wp-includes/class-wp-hook.php:324do_action('init')
wp-settings.php:700
- This reply was modified 1 year, 6 months ago by xu wu.
These are some tips monitored through the Query Monitor plugin, hoping to be helpful to you.
Info:Trying to get property ‘labels’ of non-object
position:
- wp-content/plugins/seo-by-rank-math/includes/settings/titles/taxonomies.php:15
RankMath\Admin\Options->register_option_page()
wp-includes/class-wp-hook.php:324do_action('cmb2_admin_init')
wp-content/plugins/seo-by-rank-math/vendor/cmb2/cmb2/bootstrap.php:26cmb2_bootstrap()
wp-content/plugins/seo-by-rank-math/vendor/cmb2/cmb2/init.php:165CMB2_Bootstrap_2110->include_cmb()
wp-includes/class-wp-hook.php:324do_action('init')
wp-settings.php:700
Info:Trying to get property ‘singular_name’ of non-object
position:
- wp-content/plugins/seo-by-rank-math/includes/settings/titles/taxonomies.php:15
RankMath\Admin\Options->register_option_page()
wp-includes/class-wp-hook.php:324do_action('cmb2_admin_init')
wp-content/plugins/seo-by-rank-math/vendor/cmb2/cmb2/bootstrap.php:26cmb2_bootstrap()
wp-content/plugins/seo-by-rank-math/vendor/cmb2/cmb2/init.php:165CMB2_Bootstrap_2110->include_cmb()
wp-includes/class-wp-hook.php:324do_action('init')
wp-settings.php:700
Hi, @aurangajeb ,
Thank you for your reply. The reason is simple, my country can’t access all of Google’s websites, including my website’s servers. My intent is that the plugin can’t access Google’s website for resources.