mikeytag
Forum Replies Created
-
@gripgrip I’m not sure if there’s any of my plugins that are messing with taxonomies. I haven’t exactly dug into every one of them. Here’s the list of plugins on my site. Maybe @fuego23 and I have one or more of these in common?
Ad Inserter
Ads.txt Manager
Akismet Anti-Spam
Application Passwords
Comment Whitelist
Contextual Related Posts
GTranslate
Jetpack
My Custom Functions
Post Words Count
Send Images to RSS
Site Kit by Google
Smush Pro
WP AutoTerms
WP Categories Widget
WP Native Articles Premium
WP Rocket
WP Rollback
WPCode – Insert Headers, Footers, and Code Snippets
WPMU DEV Dashboard
Yoast SEO- This reply was modified 2 years, 6 months ago by mikeytag.
Oh and if you or any other developers would like SQL dumps of my tables just let me know. I don’t think I can upload them here, but I’d be happy to share them for your dev efforts.
After digging through and debugging this, I can’t shake the idea that everything would be more performant and resilient if WPCode created its own tables instead of overloading
wp_posts
,wp_terms
,wp_term_taxonomy
, etc.Granted, I’m only taking a look under the hood now so I understand if you want to keep using it how it’s currently designed.
- This reply was modified 2 years, 6 months ago by mikeytag.
That must be it @gripgrip . When I looked at my taxonomies I had multiple entries for terms that wpcode wanted to use. My blog has been in place for over 3 years, so that must be it.
Argh, the code formatting here leaves a bit to be desired. @gripgrip here’s that line in the broader context of where it’s used. This is in the
load_all_snippets_for_type()
method.// Get the terms that are defined and then assign found snippets to their respective taxonomies // so that they can be picked up by id later without having to query again. $location_terms = $this->get_location_terms(); foreach ( $location_terms as $location_key => $location_term ) { $term_id = $location_term->term_taxonomy_id; $this->snippets[ $location_key ] = array(); // Until we update to PHP 5.3 this is the easiest way to do this. foreach ( $snippets as $snippet ) { if ( isset( $snippet->term_taxonomy_id ) && absint( $snippet->term_taxonomy_id ) === $term_id ) { $this->snippets[ $location_key ][] = new WPCode_Snippet( $snippet ); } } }
@gripgrip and @fuego23 I figured it out!
Through much debugging I found the issue. In the file
includes/class-wpcode-auto-insert-type.php
there is a line like this:
(NOTE: this is line 210 for me but I did a ton of debugging so @gripgrip I’m not sure if that’s the line in production)$term_id = $location_term->term_id;
In some debug printing I was doing I realized that
$location_term->term_id
is the incorrect property to grab. Instead, that line should be:$term_id = $location_term->term_taxonomy_id;
Hope this helps!
I see that
cache_all_loaded_snippets()
is being called on Bulk Operations and when saving an individual snippet. However, neither operation actually fills the cache for me. It’s still an empty array in the db?- This reply was modified 2 years, 6 months ago by mikeytag.
@gripgrip I think I found the culprit. It looks like the cache entry in my database is wrong?
Looking through the code I can see that the plugin tries to cache the snippets in a serialized array with the option_name of wpcode_snippets.
Here’s what my wp_options table looks like for the wpcode_snippets entry:
a:0:{}
That’s obviously not right. There should be something in that array but there isn’t. How do I recreate the cache?
@gripgrip I am having the exact same issue with Astra.
I haven’t quite figured it out but none of the following combinations work ever.HTML/Site Wide Header/No Smart Logic
HTML/Site Wide Header/With Smart Logic
HTML/Site Wide Body/No Smart Logic
HTML/Site Wide Body/With Smart Logic
HTML/Site Wide Footer/No Smart Logic
HTML/Site Wide Footer/With Smart Logic
HTML/Insert Before Post/No Smart Logic
HTML/Insert Before Post/With Smart LogicUniversal/Site Wide Header/No Smart Logic
Universal/Site Wide Header/With Smart Logic
Universal/Site Wide Body/No Smart Logic
Universal/Site Wide Body/With Smart Logic
Universal/Site Wide Footer/No Smart Logic
Universal/Site Wide Footer/With Smart Logic
Universal/Insert Before Post/No Smart Logic
Universal/Insert Before Post/With Smart LogicIt must be that there’s something with the hooks for the plugin that WordPress is not respecting. I’ll keep digging and let you know what I find.
I am using WordPress 6.0.1. FWIW, shortcodes work just fine.
- This reply was modified 2 years, 6 months ago by mikeytag.
Forum: Plugins
In reply to: [PressBackup] Zip file is corrupt – creation filedHi Brian,
I forgot to add the .1 to my version in the original post. I downloaded and installed last night and have confirmed that I am, in fact, running 0.6.5.1.
WordPress is telling me that I need to upgrade it to 3.1.2. (I am currently running WP 3.1.1). I was trying to install Pressbackup before I do this upgrade just in case corruption occurs. Do you think the fact that I am running on 3.1.1 could be part of the problem?