## How do I create a way for users to assign categories to a post from the frontend of the website?

Question

Im looking for to add categories from a frontend post. I found a thread about this topic How do I create a way for users to assign categories to a post from the frontend? almost 9 years ago. There was a solution that a user created that did exactly what I was looking for but i get the following error.

Is there a better way of doing this any suggestions would be appreciated.

Uncaught Error: __clone method called on non-object in C:xampphtdocselementor_devwp-includestaxonomy.php:3565
Stack trace:

#0 C:xampphtdocsdevwp-contentpluginsfrontendposter.phpfrontend.php(62): update_term_cache(Array)

#1 C:xampphtdocsdevwp-includesclass-wp-hook.php(287): WPSECrowdCatsClass->process_request(”)

#2 C:xampphtdocsdevwp-includesclass-wp-hook.php(311): WP_Hook->apply_filters(NULL, Array)

#3 C:xampphtdocsdevwp-includesplugin.php(478): WP_Hook->do_action(Array)

#4 C:xampphtdocsdevwp-includestemplate-loader.php(13): do_action(‘template_redire…’)

#5 C:xampphtdocsdevwp-blog-header.php(19): require_once(‘C:xampphtdocs…’)

#6 C:xampphtdocsdevindex.php(17): require(‘C:xampphtdocs…’)

#7 {main} thrown in C:xampphtdocsdevwp-includestaxonomy.php on line 3565

I know it has to do with these lines

// Add terms to taxonomy
$affected_terms = wp_set_object_terms($post_id, $suggested_terms,$tax, false ); update_term_cache($affected_terms); return$affected_terms;

0
2 years 2020-12-15T12:11:02-05:00 0 Answers 12 views 0