Your options are:
- Paste the code into a plugin
- Paste the code into a mu-plugin file
- Paste the code into a theme file like
functions.php
I manage this kind of thing with a plugin that builds a simple interface– basically an “execute” button. I alter the code that executes as needed. That seems to give me the most control. The code only executes when I navigate to the right screen and run it intentionally.
Pasting into functions.php
, or similar, and then quickly deleting the code is not a reliable way to run code once. That code will run as many times as your site has visitors before you can delete it again.
You could save an option to the database on first run to prevent a second fire, but that seems like overkill for this kind of “maintenance” code.
Related Posts:
- WordPress database error: [Not unique table/alias: ‘wp_postmeta’]
- How much faster is a tax query than a meta query?
- Use custom posts as taxonomy term meta replacement?
- Is it possible to sort the post based on a custom field?
- List Custom Taxonomy Values according to a Post Meta Value
- Landing in 404 Page on Navigating to Custom Taxonomy Archive
- how to get title to custom tags page
- Getting yoast title for custom taxonomy
- get_the_terms() to show all custom taxonomies
- Single reusable value for post meta: Custom Taxonomy or Post Meta?
- need advice on how to do a lists using custom post types – taxonomy vs postmeta
- Current category link filter
- What is faster: custom taxonomy or serialized post-meta for db retrieval? (over 60,000 posts)
- Is it possible to store Json data in post_meta and manipulate
- Add Custom Taxonomy for Blog Meta Info
- How to separate posts in loop?
- Creating terms vs custom post meta to save data?
- Does using custom taxonomy is more CPU efficient than using meta_data?
- Output unique taxonomy terms of posts inside a loop
- Is it safe to register a taxonomy without using any hooks?
- wp_query not resetting, last post hanging
- how to get term id from current post type instead of name
- Count of posts by different parameters?
- WordPress sub taxonomy template
- Sort and paginate custom post taxonomies alphabetically
- WooCommerce custom taxonomy as meta?
- Sort taxonomy page alphabetically by meta rather than default post date
- Convert post meta to custom taxonomy?
- True or F False Setting of ‘with_front’ Parameter of Rewrite Is returning Exact Same result
- Get taxonomy link with post type slug prefix
- Count tags for current post and save into custom meta field (and update it on post edit)
- See double taxonomy inputs in WP editor
- setting a custom post type taxonomy term by code
- transfer two existing taxonomy terms into one custom metabox
- Is it possible to sort the post based on a custom field?
- Dynamic drop down of child terms and then drop down posts
- How to get list of custom taxonomies based on custom post type
- Custom post type term names with ampersand in the term name
- Looking for suggestions on creating simple database (Help!!)
- get meta fields and taxonomy of any post type
- How to make an sql query to exclude everything but custom taxonomy terms in table wp_terms?
- Update fields with post object and custom tax with wp_insert_post
- How can I show custom field according to taxonomy?
- How to associate string with individual use of taxonomy term
- Custom taxonomy with custom meta value is not sorting correctly (query returns the same value for orderby regardless of sort column click)
- How to add images to taxonomies?
- Read-only taxonomy (user can assign term but can’t create or edit existing terms)
- Can you add the visual editor to the description field for custom taxonomies?
- Adding Category/Tag/Taxonomy Support to Images/Media
- Large taxonomy (2000+ terms), causing WordPress to hang
- Is it possible to have a taxonomy archive that lists taxonomy terms?
- Check if current term is a child of another term
- How to pass posts_per_page and paged params query vars to custom taxonomy archive urls?
- Looping Through Custom Tax Terms and Displaying All Posts For Each
- Exclude Custom Taxonomies
- How to get the top most term (top ancestor) of a custom taxonomy child term?
- Get custom category name from ID
- Set download limit and expiry for WooCommerce downloadable products in specific categories
- How to order a list of taxonomy terms alphabetically?
- get_the_terms issue
- ACF vs Taxonomies
- Reverse traversing taxonomy based on term_id
- ‘wp’ action hook not firing in admin and login?
- Display all posts for taxonomy term across multiple custom post types
- Taxonomies on custom taxonomies
- Get list of taxonomies associated with Subscribers
- How to join result of different taxonomies?
- How to add Post Format Taxonomy Archive page in the menu?
- How to add custom label or texts in featured image
- Create custom taxonomy and Display in metabox dropdown
- Archieve.php not loading for custom post type
- Adding content to custom taxonomy category pages
- Display formatted list of taxonomy terms with last seperator different
- Proper WP conditional tag to check for existing taxonomies to list out terms with wp_list_categories?
- Display a colour of custom taxonomy on the page
- Filter through custom taxonomy with an array of taxonomy IDs
- Add attribute taxonomy through code don’t appear in admin product page
- save custom term – hook create_term doesn’t work
- Taxonomy Overview Page?
- How to avoid foreach error WebDevStudio’s WDS_Taxonomy_Radio taxonomy metabox class?
- Unable to get the Parent Custom Taxonomy Terms
- Catch all taxonomy template
- Custom taxonomy huge list not loading properly in select box
- Query Multiple Custom Taxonomies
- WordPress REST API – get custom taxonomy category posts
- Pull data from MySQL and add it to terms
- Is it possible to filter a taxonomy archive by other taxonomies that are on posts?
- Make relation of custom taxomies
- How to change taxonomy slug?
- Taxonomy to WordPress Permalinks of custom post type
- Avoiding stripping of HTML in Custom Taxonomy Meta Field
- Advanced AND tax_query in sidebar with 2 taxonomies
- Create WordPress taxonomies based on theme settings
- Alternative for is_taxonomy() to workaround theme’s default sidebar
- Head Code for Custom Taxonomy
- Adding new terms to custom taxonomy
- List posts grouped by children of a custom taxonomy
- Taxonomy to display form after creation
- How home my code doesn’t display any feature image? Looping through post from a taxonomy and not getting feature images back
- Add taxonomy fields of posts into RSS feed