Closed MartinMedi closed 3 years ago
Hello,
but inside wp-admin there 4 posts tagged to "flaviviren"
The name
shortcode parameter is for categories, not tags. This is why you are not seeing what you expected.
Yes, by tagged I accordingly meant tagged to category flaviviren. We are using category-names throughout the site.
Have you tried it with WP_DEBUG enabled? Anything in the error log?
WP_DEBUG enabled does not show any errors/warnings on page render.
I just enabled debug.log and requesting the page resulted in the following errors (14x those 3 errors) [18-Jan-2021 16:47:33 UTC] PHP Notice: Trying to get property 'term_id' of non-object in /htdocs/_subdomain-staging/wp-includes/class-wp-query.php on line 3744 [18-Jan-2021 16:47:33 UTC] PHP Notice: Trying to get property 'name' of non-object in /htdocs/_subdomain-staging/wp-includes/class-wp-query.php on line 3746 [18-Jan-2021 16:47:33 UTC] PHP Notice: Trying to get property 'slug' of non-object in /htdocs/_subdomain-staging/wp-includes/class-wp-query.php on line 3748
Unfortunately, it does not state which function/plugin caused this. Do you think that is coming from catlist? Any other way pinpointing it down?
LCP relies heavily on WP Query so unless you are also using another plugin that makes a lot of post queries these logs probably come from the LCP plugin.
This kind of error usually means a user specified a wrong category but if you are sure you made no mistakes this could be something else. I'll have a look later in testing env.
Thanks! Yes on that particular page is mostly catlist doing queries.
One thing I came up with: I think "Pro" Content Builder might also be partially responsible in this matter. It might get a hiccup with saving the correct shortcode and executing it at runtime. Is there a way to let catlist log the queried "shortcodes" / cat-names ? that result in non-object results.
Is there a way to let catlist log the queried "shortcodes" / cat-names ? that result in non-object results.
Not without editing the plugin's code.
I wasn't able to reproduce your issue, I tried over 200 calls to lcp on a single page (using your shortcode) and it was fine.
Please install this plugin and let me know if it detects potential problems.
That is true. I observed: Inside Pro Content Builder the shortcode had a blank space between 'name=' and 'flaviviren' ('name= flaviviren'). When I deleted the space, the page-preview inside the content builder started to render that particular catlist call correctly, resulting in 4 list items. but saving the page, and requesting the URL does not show the items on actual rendered page.
Another, maybe interesting, information: I tried changing out the cat-name we are querying here, used the primary top category here which is "infektiologie". Infektiologie has 121 posts. But catlist call only shows the last 33 items, starting with posts starting with letter R. But from "R" on, it seems to show all remaining items... Is that of any help?
Query Monitor plugin unfortunately results in 500 error code with wordpress pages having ui-rich Pro Wordpress-theme. In WP-Admin it does work, but I guess I have to access the corresponding wordpress page where those catlist calls are made?
I observed: Inside Pro Content Builder the shortcode had a blank space between 'name=' and 'flaviviren' ('name= flaviviren'). When I deleted the space, the page-preview inside the content builder started to render that particular catlist call correctly, resulting in 4 list items. but saving the page, and requesting the URL does not show the items on actual rendered page.
Yes, this is the expected behavior. If you add name=
to your shortcode, the list is empty. Your Pro Content Builder plugin is clearly causing this, somehow changes the shortcode while saving the page. I have no experience with that plugin so cannot assist with that but if you can find a way for that plugin to leave shortcodes unchaged, the "empty list" issue will be gone. Searching their support threads might be helpful.
Query Monitor plugin unfortunately results in 500 error code with wordpress pages having ui-rich Pro Wordpress-theme. In WP-Admin it does work, but I guess I have to access the corresponding wordpress page where those catlist calls are made?
Yes, if your particular WP setup is incompatible with Query Monitor it won't be of any help.
But catlist call only shows the last 33 items, starting with posts starting with letter R. But from "R" on, it seems to show all remaining items... Is that of any help?
Maybe the LCP plugin pulls the posts correctly but then your builder plugin truncates the list somehow. Hard to say without access to the site. You can try inspecting that list in developer tools or just in page source to see what is actually going on.
Okay, thanks again for your thoughts! I will try to check back with them on this matter.
In the meantime, can we temporarily modify the plugins code, so we have a debug log of the queries requested through shortcodes? This would be the fastest way to track down -what- exactly is going on, whether it be on catlist's -or- Pro's side. If you could provide the required snippet and / or file I will be temporarily integrating it in our version of catlist, temporarily. That would be great!
To get a full dump of each WP_Query object the LCP plugin creates, in include/lcp-catlist.php
after line 90 insert something like this:
error_log( '--- WP_Query ---' . PHP_EOL );
error_log( print_r( $wp_query, true ) );
error_log( '--- End WP_Query ---' . PHP_EOL );
Be warned that the WP_Query object also includes matching posts so your error log could become very big very quickly. To get only simple query vars that the plugin actually passed to WP_Query, replace $wp_query
from the example above with $wp_query->query
.
Thanks! I just did some test queries with those logs enabled.
Those are the results. I have pasted results for category 'onkogeneviren' which has 7 posts. I have truncated the logs, but can send full pastebins if you need it! At first sight, I think set up of Query objects/taxonomy is equal in all 3 scenarios (but can send full pastebins if you want) -> Difference is at resulting [request] SQL Request. Testing scenarios are: 1) the long Pro-themed page, which fails to display catlist items correct.
2) minimal test.php with include(wp-load.php); echo do_shortcode(catlist...);
3) new, fresh Pro-themed page, with just 1 text element, 1 catlist call.
So its not Pro in general that is responsible for the error, a clean Pro page renders correct.. Please see the SQL Queries below.
Cat: onkogeneviren shortcode call: [catlist class="catlisttext" name=onkogeneviren orderby=title order=asc catname=no catlink_class=catlistlisttextcatname catlink_tag=div]
[queried_object] => WP_Term Object
(
[term_id] => 3918
[name] => Onkogene Viren
[slug] => onkogeneviren
[term_group] => 0
[term_taxonomy_id] => 3918
[taxonomy] => category
[description] =>
[parent] => 7
[count] => 7
[filter] => raw
[term_order] => 0
[cat_ID] => 3918
[category_count] => 7
[category_description] =>
[cat_name] => Onkogene Viren
[category_nicename] => onkogeneviren
[category_parent] => 7
)
[queried_object_id] => 3918
[request] =>
1) long Pro-themed page
SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) WHERE 1=1 AND (
wp_term_relationships.term_taxonomy_id IN (3918)
) AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish')AND (wp_posts.post_title COLLATE UTF8MB4_GENERAL_CI LIKE 'r%'OR wp_posts.post_title COLLATE UTF8MB4_GENERAL_CI LIKE 's%'OR wp_posts.post_title COLLATE UTF8MB4_GENERAL_CI LIKE 't%'OR wp_posts.post_title COLLATE UTF8MB4_GENERAL_CI LIKE 'u%'OR wp_posts.post_title COLLATE UTF8MB4_GENERAL_CI LIKE 'v%'OR wp_posts.post_title COLLATE UTF8MB4_GENERAL_CI LIKE 'w%'OR wp_posts.post_title COLLATE UTF8MB4_GENERAL_CI LIKE 'x%'OR wp_posts.post_title COLLATE UTF8MB4_GENERAL_CI LIKE 'y%'OR wp_posts.post_title COLLATE UTF8MB4_GENERAL_CI LIKE 'z%') GROUP BY wp_posts.ID ORDER BY wp_posts.post_title ASC LIMIT 0, 9999
==> 0 results
2) minimal test.php with include(wp-load.php); echo do_shortcode(catlist...);
SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) WHERE 1=1 AND (
wp_term_relationships.term_taxonomy_id IN (3918)
) AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish') GROUP BY wp_posts.ID ORDER BY wp_posts.post_title ASC LIMIT 0, 9999
==> 7 results
3) new, clean Pro-themed page (just 1 text-box, 1 catlist call)
SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) WHERE 1=1 AND (
wp_term_relationships.term_taxonomy_id IN (3918)
) AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish') GROUP BY wp_posts.ID ORDER BY wp_posts.post_title ASC LIMIT 0, 9999
==> 7 results
Can you send those pastebins and a list of plugins for each of these 3 test cases?
In case 2 and 3 these are proper LCP queries. The first one has been filtered and altered by other piece of software, LCP doesn't include code that could generated a query like that.
EDIT: I think I know what the problem is.
@MartinMedi The fix is available in #440. You can use that branch of the plugin or wait for changes to be pushed to WP repository.
Awesome - works perfectly well now! Thanks a lot!
Hey dear Dev Team,
we have a little problem with the catlist plugin for wordpress. For some reason, shortcode execution (on large wordpress pages?) does fail sometimes and won't display either any results or just a few of the actual resulting posts from our query.
For example, we have an overview page where we have approx. >40 catlist calls (inside different tabs, accordeons) and cant get catlist to work properly here. Example call: [catlist class="catlisttext" name=flaviviren orderby=title order=asc catname=no catlink_class=catlistlisttextcatname catlink_tag=div] --> Is outputting an empty list - but inside wp-admin there 4 posts tagged to "flaviviren"
WP version, LCP plugin version (versions of other software if relevant, e.g. PHP)
WP: 5.6 catlist: 0.83.1
We use "Pro" Content Builder by theme.co as our Wordpress Theme.
What other information do you need? We have tried several approaches but werent able to reproduce / narrow down what triggers the error - or when it starts to fail.
Looking forward to some help from you, thanks in advance!
Martin