• Hello

    We upgraded our blog from 2.9.2 to 3.1 version. Everything worked fine except that we found a problem with a custom taxonomy related in a custom post type we created.

    We experienced problems when special characters (it’s a blog in Spanish) were used in the title of the taxonomy.

    For example, a custom query had troubles to get the post ID for a post named “La novia de ?zil”, as well as retrieve the values for the custom fields associated with this post type. Other posts worked fine, but still we see the same problem whenever an accented vowel is used in the name of the taxonomy term (hierarchical).

    I don’t know if this is a bug or a problem with our database. We experienced the same in both development and production servers.

    The charset for both were at UTF-8. We checked also commenting this lines in wp-config.php but the issue remains.

    I appreciate any help on finding the problem!

    PS. You can see what I mean with the post ID not being read here: https://dev.kienyke.com/ in the FOTO SHOW section, where every title is preceded with the post ID. Check the third thumbnail with missing ID.

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • 3.1 added checking for capitals in CPT, Menus, Sidebars, and Taxonomies. If you’re CPT names have capitals in them then this could be the issue. Can you provide code samples (via pastie) for the registration of the CPT’s and the query in question.

    Thread Starter camilodelvasto

    (@camilodelvasto)

    Thank you for checking it.

    Well, the CPT were registered using:

    function kien_post_types() {
    	register_post_type( 'fotoshows', array(
    										   'label' => __('Fotoshows'),
    										   'singular_label' => __('Fotoshows'),
    										   'public' => true,
    										   'show_ui' => true,
    										   'capability_type' => 'post',
    										   'hierarchical' => false,
    										   'rewrite' => true,
    										   'menu_position' => 5,
    										   'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions'/*, 'page-attributes'*/ ),
    'taxonomies' => array('category')
    										   ) );
    
    	register_taxonomy( 'kien-fotoshows', 'fotoshows', array( 'hierarchical' => true, 'label' => __('Fotoshow Categories') ) );
    	register_taxonomy( 'kien-fotoshows-structure', 'fotoshows', array( 'hierarchical' => true, 'label' => __('Fotoshow Structure') ) );
    
    	register_taxonomy( 'kien-structure', 'post', array( 'hierarchical' => true, 'label' => __('Kien Structure') ) );
    	register_taxonomy( 'temas', 'post', array( 'hierarchical' => true, 'label' => __('Temas'), 'rewrite'=>true ) );
    }
    add_action( 'init', 'kien_post_types' );

    The query I’m using:

    $show_posts	= get_posts( 'post_type=fotoshows&numberposts=10&kien-fotoshows-structure=Home Fotoshow' );

    I suspect this should be a bug, since this was working before and it indeed works if I delete all the special characters from category names.

    I’m experiencing the exact same problem. I run a site the makes use of custom post types as well as custom taxonomy.

    $premises = mysql_query("SELECT wterms.name, wterms.term_id
    FROM wp_terms wterms
    JOIN wp_term_taxonomy tax ON wterms.term_id = tax.term_id
    JOIN wp_icl_translations t ON tax.term_taxonomy_id = t.element_id
    WHERE tax.taxonomy = 'city' AND t.language_code = 'sv' AND t.element_type ='tax_city' AND tax.count <> 0
    ORDER BY name ASC");
    
    ?>
    <ul class="city-list">
    <?php
    
    $args = array(
    'post_type' => 'premise',
    'posts_per_page' => -1
    );
    $cityposts2 = get_posts($args);
    if (count($cityposts2)>0) {
    while ($query = mysql_fetch_assoc($premises)) {
    
    $args = array(
    'post_type' => 'premise',
    'posts_per_page' => -1,
    'city' => $query[name]
    );
    $cityposts = get_posts($args);
    if (count($cityposts)>0) {
    echo '<li>'.the_ttftext($query[name],true,'citylist');
    foreach($cityposts as $post) :
       	setup_postdata($post);

    This code basically checks to see if the taxonomies (cities) have any posts, and if they do, it displays the city name and all of its posts undername.

    On 2.8 this worked perfectly.

    However, after upgrading to 3.1 (I skipped a few), whenever I have a taxonomy (city name) with special characters, such as ?, ? and ? (Swedish names use these) the query seems to return this as no posts. Neither the city name or the posts are displayed.

    However, I can open the post directly, and it displays fine, and on that single post site, I do display the taxonomy and on that page the special character is shown correctly(!).

    It leads me to think there is something with the SQL query and the WP files that have a mismatch somehow.

    Did something change with the charset settings that could have this effect? I use utf8, and always have been.

    At least it’s nice to find that I’m not alone with this issue… ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom post types problems after upgrade’ is closed to new replies.