Getting the correct value for a post

I’ve added correct indenting to your question, which should make the problem more obvious. The problem is that you meant: foreach ( $state as $state ) update_post_meta($post_id,’state’,$state->name); What you actually put is: foreach ( $state as $state ); update_post_meta($post_id,’state’,$state->name); Which expands to: foreach ( $state as $state ) { // do nothing } //insert post … Read more

Append custom parameter to taxonomy/term URI

You can try this: function my_car_rewrite_rules( $rules ) { $newrules = array(); // add a rule for this kind of url: // http://myhost.com/cars/ferrari/used/123 // => http://myhost.com/index.php?post_type=cars&ferrari=used&p=123 $newrules[‘^cars/([^/]+)/([^/]+)/([^/]+)$’] = ‘index.php?post_type=cars&$matches[1]=$matches[2]&p=$matches[3]’; return $newrules + $rules; } add_filter(‘rewrite_rules_array’,’my_car_rewrite_rules’); and remember to “save the permalinks” when testing. I added /cars/ so this rewrite will not overwrite your other pages. … Read more

Find all posts via SQL beginning with A of type B

Try this.. SELECT * FROM $wpdb->posts p INNER JOIN $wpdb->term_relationships tr ON p.ID = tr.object_id INNER JOIN $wpdb->term_taxonomy tt ON tr.term_taxonomy_id=tt.term_taxonomy_id inner join $wpdb->terms t on t.term_id=tt.term_id and t.slug=’igralni’ WHERE p.post_title LIKE ‘А%’ AND p.post_type=”filmi-i-serialii” AND p.post_status=”publish”

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