Bulk import or programmatic creation of attributes

Hi,

I’m rebuilding a HivePress-based classifieds site after a database issue and I lost all the custom attributes (stored in wp_hivepress_attribute, wp_hivepress_attribute_field, etc.).

I still have the full list of attributes, including:

  • name
  • slug
  • field type (text, select, number, etc.)
  • options (for select fields)
  • categories they should be assigned to

Is there any official or recommended way to bulk import attributes from a CSV/Excel file, or to create them programmatically via PHP?

Even a simple code snippet to insert them would be helpful. I’m comfortable using a custom plugin or adding a function temporarily.

Thanks in advance for any advice!

Hi,

This depends on the source file, if it’s an XML file exported via Tools/Export you can try importing it via the same tool, but CSV files may require a more advanced solution, for example WP All Import plugin.

If the fields were removed, but the actual values are still stored in the database (you can check this in wp_postmeta table for example), then adding attribute fields manually may be the best option.

Hope this helps