PHP Functions

delete_acnm_meta

This function deletes all custom fields with the specified key, or key and value, from the specified term.

Parameters:

  • $menu_item_id – The ID of the term from which you will delete a field.
  • $meta_key – The key of the field you will delete.
  • $meta_value (optional) – The value of the field you will delete. This is used to differentiate between several fields with the same key. If left blank, all fields with the given key will be deleted. Default: Empty

Example: delete_acnm_meta(1, 'acnm_genre');

get_acnm_meta

This function returns the values of the custom fields from the specified term.

Parameters:

  • $menu_item_id -the menu item id that you wan’t to fetch meta.
  • $meta_key (optional) – A string containing the name of the meta value you want. Default: null
  • $single (optional) -If set to true then the function will return a single result, as a string. If false, or not set, then the function returns an array of the custom fields. This may not be intuitive in the context of serialized arrays. If you fetch a serialized array with this method you want $single to be true to actually get an unserialized array back. If you pass in false, or leave it out, you will have an array of one, and the value at index 0 will be the serialized string.
    Default: false

Example: get_acnm_meta(1, 'acnm_genre', true);

update_acnm_meta

This function lets you add or update a nav menu item meta.

Parameters:

  • $menu_item_id – the menu item id that the meta refers to.
  • $meta_key – A string containing the name of the meta key ( meta name ) you want to update.
  • $meta_value – the new value you want to update your meta.
  • $prev_value (optional) – the previous value of your term meta. Default: Empty

Example: update_acnm_meta(1, 'acnm_genre', 'F');

Leave a Reply