wp set object terms vs wp set post terms

Right there is no big difference between them, actually wp_set_post_terms() uses wp_set_object_terms() but does few extra check for you. That’s also noted on wp_set_object_terms() Codex page: Perhaps the wp_set_post_terms() is a more useful function, since it checks the values​​, converting taxonomies separated by commas and validating hierarchical terms in integers. http://codex.wordpress.org/Function_Reference/wp_set_object_terms#Notes

tax_input not working wp_insert_post

The most common reason is that you run this code without user context (cron, etc). Within wp_insert_post() context WP will check if user has permissions to a taxonomy. No user equals no permissions equals no terms being assigned. The workaround is to create post first, then assign terms to it. When terms are assigned explicitly … Read more

wp_insert_post add meta_input

meta_input is just a single-dimension array as key => value: ‘meta_input’ => array( ‘name’ => $post[‘name’], ‘city’ => $post[‘city’] ) tax_input is slightly different, with tax as key and an array of values: ‘tax_input’ => array( ‘taxonomy_name’ => array( ‘term’, ‘term2’, ‘term3’ ) ) Note that for tax_input to work, the user currently logged in … Read more

wordpress sanitize array?

Here’s a way to do it with PHP’s array map function: // Good idea to make sure things are set before using them $tags = isset( $_POST[‘tags’] ) ? (array) $_POST[‘tags’] : array(); // Any of the WordPress data sanitization functions can be used here $tags = array_map( ‘esc_attr’, $tags );

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