• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: PHP to create and add tags to an existing article

PHP to create and add tags to an existing article 4 years 5 months ago #40733

I want to create one or more new tags, add them to Joomla tag table and associate them with an existing article with a given ID.

e.g article ID is 28 and tags are named "Firsttag", "secondtag". My PHP script is not working and the field for Tags in RSform's Create Article Configuration is not work


defined('_JEXEC') or die('Restricted access');

use Joomla\CMS\Form\Form;
use Joomla\CMS\Factory;
use Joomla\CMS\Table\Table;
use Joomla\CMS\Helper\TagsHelper;


$content = JTable::getInstance("Content", 'JTable', array());
$content->load($id) = 28;

$title = "Tag Title";
$i = new JHelperTags;
$i->createTagsFromField(array("#new#$title"));


$i = new JHelperTags();
$i->tagItem($content->id, $content, array("Firsttag", "secondtag"));
JHelperTags::addTags(array("tag1", "tag2"), $content);

$i ->store();
Last Edit: 4 years 5 months ago by obiajulu.odu.
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!