MySQL Forums
Forum List  »  Triggers

Trigger isn't only updating new entries...
Posted by: Jim Reamer
Date: September 05, 2017 01:58PM

In WordPress, I'm taking the Tag value (term_id in wp_terms) over my own data table (a_players), so I can link the additional information in my data table to each Tag's archive page.

The Trigger below does what I need. However, it doesn't just do new Tag entries. In testing it before my site goes live, I noticed it also linked previously established entries. That tells me it's scanning both data tables regardless if it's necessary or not.

So while it's taking care of my needs, I'm wondering how I can make this more efficient by making sure it just applies it to the term_id of the new entries.

Action Time: After
Event: Insert

update a_players p
join wp_terms t
set p.wpID = t.term_id
where t.slug = p.wpSlug

Options: ReplyQuote

Written By
Trigger isn't only updating new entries...
September 05, 2017 01:58PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.