• I display parent level categories on my site as separate pages, the way that WordPress naturally sets them up. I have a handful of these top-level category pages, and they are in my main nav.

    I installed the update of the plugin to 1.3.3 and two, not all, but just two of my category pages showed as “Not Found” when you went to them.

    I have reverted to the older 1.3.1 version of the plugin, and everything is fine again, but I am at a loss as to how to fix this in order to update the plugin again. Any ideas?

    Thanks!

    https://www.ads-software.com/plugins/cpt-onomies/

Viewing 15 replies - 16 through 30 (of 33 total)
  • I’ve made some changes and they’re in the development version. Can anyone test these out for me?

    Once you’ve updated to the development version, be sure to check out your settings page to see if you get the message “Yes, but there might be a terms conflict.” in your “Registered CPT-onomy column.

    Thanks!

    I tested it, but unfortunately it’s still not working. The settings page just says a green “yes” for all three CPT-onomies that I use.

    Hmm. Is there any way you can get me the query that’s being run? If you don’t know how, let me know and I’ll send some ideas. It would be really helpful.

    It’s just the regular WordPress loop inside the category.php. No modifications, just going through the results with while have_posts()

    Can you setup the following code in your functions file and tell me what it says?

    I added is_user_logged_in_() logic so it only shows up if youre logged in, in case this is a live site. Of course, if this is a membership site, or something like that, you might need to change that.

    You can also change is_category() to is_category( 'Category ID, title or slug' ) to make the logic more category speficic.

    Thanks!

    add_action( 'wp', 'my_website_get_query_request' );
    function my_website_get_query_request() {
       global $wp_query;
    
       if ( ! is_user_logged_in() )
          return;
    
       if ( is_category() ) {
    
          echo "<pre>";
          print_r( $wp_query->request );
          echo "</pre>";
    
       }
    
    }
    SELECT SQL_CALC_FOUND_ROWS  xx_posts.ID FROM xx_posts  INNER JOIN xx_term_relationships ON (xx_posts.ID = xx_term_relationships.object_id) INNER JOIN xx_term_relationships AS cpt_onomy_tt1 ON (xx_posts.ID = cpt_onomy_tt1.object_id) WHERE 1=1  AND (
      xx_term_relationships.term_taxonomy_id IN (212,1142,1407,1413,1446,1471,1588,1513,1589,1590,1599,1602,2113,2119,2140)
    ) AND xx_posts.post_type = 'post' AND (xx_posts.post_status = 'publish' OR xx_posts.post_status = 'private') AND ( cpt_onomy_tt1.term_taxonomy_id IN (1513) ) GROUP BY xx_posts.ID ORDER BY xx_posts.post_date DESC LIMIT 0, 12

    It looks like you have some conflicting taxonomy terms. Did you ever have a plain taxonomy with the same name? It looks like that taxonomy still has some terms in the database and it’s confusing the query.

    I wrote up some (hopefully) helpful tips for dealing with this: https://wpdreamer.com/plugins/cpt-onomies/documentation/incorrect-query-results/

    The changes I made to the plugin should’ve detected your terms, though. Hmm.

    I used to have custom taxonomies with the same name, but I don’t have them anymore. I checked the term_taxonomy database and I couldn’t find any of them anymore.

    I don’t know if that information will help, but those term_taxonmy_ids listet are all IDs from regular categories that are attached to the main term_taxonomy_id 1513.

    I think my custom taxonomies got screwed up some time ago. When I print all my custom taxonomies, WordPress still lists the old ones. But they aren’t really there anymore. They are not listed inside my functions.php and they don’t have any posts attached to them. I guess it must be from a time when I didn’t really know much about php and used a plugin for that.

    Is there a simple way to delete those? Otherwise I’ll try to rename my CPT-onomies and see if that works (unless there could be problems with your plugin)

    What’s the name of your taxonomy and custom post type/CPT-onomy?

    “sendung” and “sender”

    Without knowing the extent of how screwed up your taxonomy is, I can’t really make a suggestion. If it were me, I’d go into the database and remove them manually but if you’re not comfortable with that, then I wouldn’t do it.

    If you want to change the name of your custom post type/CPT-onomy, you can use the following code to make sure the name is updated in the database, and obviously set the $new_name to your new name.

    global $wpdb;
    
    $old_name = 'sender';
    $new_name = 'newname';
    
    $wpdb->update(
          $wpdb->posts,
          array(
                'post_type' => $new_name,
          ),
          array(
                'post_type' => $old_name
          ),
          array( '%s'  ),
          array( '%s' )
    );

    Thanks for that code, I renamed my cpt-onomies. However, it’s still not working for me. But there aren’t any old taxonomies anymore. The WordPress function get_taxonomies prints:

    • category
    • post_tag
    • nav_menu
    • link_categor
    • post_format
    • author
    • channel
    • series

    With the last two being the renamed cpt-onomies.

    For a comparison, here’s the output of your first code, when I have 1.3.3 installed:

    <pre>SELECT SQL_CALC_FOUND_ROWS  lunadb8_posts.ID FROM lunadb8_posts  INNER JOIN lunadb8_term_relationships ON (lunadb8_posts.ID = lunadb8_term_relationships.object_id) WHERE 1=1  AND (
      lunadb8_term_relationships.term_taxonomy_id IN (212,1142,1407,1413,1446,1471,1588,1513,1589,1590,1599,1602,2113,2119,2140)
    ) AND lunadb8_posts.post_type = 'post' AND (lunadb8_posts.post_status = 'publish' OR lunadb8_posts.post_status = 'private') GROUP BY lunadb8_posts.ID ORDER BY lunadb8_posts.post_date DESC LIMIT 0, 12</pre>

    The difference is that the dev version has the following line inside the output:
    AND ( cpt_onomy_tt1.term_taxonomy_id IN (1513)

    Well, get_taxonomies() is only going to print taxonomies that are currently “registered”, i.e. the register_taxonomy() function is currently being run within existing code. It will not show taxonomies that used to be registered and still have term information in the database.

    Run the following code and compare the list:

    global $wpdb;
    $stored_taxonomies = $wpdb->get_col( "SELECT taxonomy FROM {$wpdb->term_taxonomy} GROUP BY taxonomy ORDER BY taxonomy ASC" );
    echo "<pre>";
    print_r( $stored_taxonomies );
    echo "</pre>";
Viewing 15 replies - 16 through 30 (of 33 total)
  • The topic ‘1.3.3 broke categories on my site’ is closed to new replies.