Exclude categories from the_category();

Try using the filter get_the_categories and replace every occurrence of the_category by echo get_the_category() (just to be sure !) This is what I cooked: <?php add_filter(‘get_the_categories’, ‘exc_cat’); function exc_cat($cats) { //not on admin pages if(!is_admin()){ $exc = array(‘lipsum’, ‘dolor’); foreach ($cats as $i=>$cat){ if(in_array($cat->name, $exc)){ unset($cats[$i]); } } } return $cats; } ?> Try my … Read more

wpdb query problem to access previous 3 days posts

You are asking for the last three posts ordered by post date, not for the posts from the last three days– ORDER BY post_date DESC LIMIT 3. post_date has a time component to it. It is not just marked with a date. Even so, that LIMIT would restrict the query to last three in the … Read more

Searching With Apostrophe

Your question isn’t much of a WordPress related question, more like a MySQL question. But I have sort of a solution in my head: You could go with a custom query and a replace on the apostrophe: SELECT * FROM `table` WHERE REPLACE( `column`, “‘”, “”) LIKE REPLACE( ‘string’, “‘”, “” ) For a combined … Read more

MySql Query very slow

You must use a temporary table and an alias: SELECT SQL_CALC_FOUND_ROWS * FROM meruca_posts WHERE ID NOT IN (SELECT ID FROM ( SELECT object_id as ID FROM meruca_term_relationships WHERE term_taxonomy_id IN (14) ) AS temp_object) AND post_type=”post” AND post_status IN (‘publish’,’private’) GROUP BY ID ORDER BY post_date DESC LIMIT 0, 10

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)