Support » Fixing WordPress » Quick check of code sanity

  • All,

    I have the following call that worked a-ok in WP 1.5, that seems to fail to retrieve valid data under v 2.0 (yes I know it’s not in general release yet), but someone might be able to spot the goof.

    Code snippet:

    <?php $sidenote_cat = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE category_nicename = 'asides'"); ?>

    Under 1.5, that will (obviously) perform a valid mySQL lookup, under 2.0 it fails to actually generate any result (it’s used before the_post loop). Is there anything new I need to add to ensure I’m making the right db calls?


Viewing 1 replies (of 1 total)
  • Ok, I’ve cleaned up the mySQL call – which works..


    <?php if ( in_category($sidenote_cat) ) { ?>

    .. doesn’t return ‘true’ – even if the (category) result is actually true.

Viewing 1 replies (of 1 total)
  • The topic ‘Quick check of code sanity’ is closed to new replies.