↑ Return to P60 Plugins for Tags

P69 New Fields WP Taxonomies & Options


Page no: P68

This table describes the new fields used by different plugins on the WordPress for taxonomies.

It does not describe the standard fields in the DB overview below, but only the new fields for taxonomies.

One example: Category Picture, what is the field used to store the category picture.

 

Entity relationship diagram for

  • Terms
  • Taxonomies (like tags or categories)
  • Posts
  • Links
  • and their relationship table wp_term_relationships

 

Unfortunately the taxonomies do not have meta tables like Post_meta and User_meta.

 

 

 

Solution if there were a taxonomy meta table

For the Pictured Category plugin, we would have used a WP_Taxonomy_meta table that associates each taxonomy (like a category) with a couple of meta Ids and their meta values (like category picture, Show yes/no, image URL,..)

 

Effective problem

WP_OPTIONS is a stupid data dump for attributes that cannot be assigned to posts or users, but to other objects.

Caused by this stupid WordPress DB design we must create one new row in WP_OPTIONS for each category and fill it with a serialized array.

This way we can replicate the DB table with the meta ID and meta value inside an array.

 

Array Name Table Attribute Name Possible values
Our Plugin? used..by…Plugin Functionality GUI ScreenShot
category_7564  wp_options category_7564 (id of category)

array (
‘show’ => ‘1’,
‘settings’ => ‘4’,
‘img’ => ”,
‘mtop’ => ”,
‘mbottom’ => ”,
‘user’ => ‘492’,
)

Serialized array Yes Pictured Cats

Pictured Category plugin

category_7564 Show  1 or 0
1: means on
0: means off
Yes Pictured Cats Says if the pictured category is shown in the front end
 settings  1 to 4
1: Show Category Picture as logo
2: Show Category Picture and text as logo
3: Show Category Picture above bio
4: Show Author avatar as logo and Category Picture above bio
Yes Pictured Cats
 img  http://snbchf.com/wp-content/uploads/2016/11/category.jpg  Yes  Pictured Cats  RL of the image
 mtop  10  Yes  Pictured Cats position from top
 mbutton 15  Yes  Pictured Cats position from bottom
 user  492  Yes  Pictured Cats  ID of the main author

 

See more for P6x Plugins for Tags