Give a unique ID while saving

When you add a meta box, the post object is passed to the function that outputs your meta box content, and the ID is immediately available. Here’s a quick proof-of-concept that will put the ID in a field in a post meta box when creating a new post: function wpd_sku_meta_box() { add_meta_box( ‘wpd_sku’, ‘SKU’, ‘wpd_render_meta_box’, … Read more

Are post, page and category IDs unique to each other?

There are multiple types of data objects: posts: pages, regular posts, nav menu items, attachments and custom post types terms for different taxonomies: categories, tags, nav menus comments links options various meta data Term ids are for a different type of objects than post ids. Both are primary keys for different tables. From Potential roadmap … Read more

Accessing Post ID Within Loop

The problem probably comes from whenever a $post has no terms set. You need to set $brand = array() outside your IF statement, add it just under get_the_terms(). At that point it also wouldn’t hurt to wrap your switch statement in a if( ! empty( $brand ) ) { Another problem I see with this … Read more

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