Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Where to put a migration script to switch post information?

Your options are:

  1. Paste the code into a plugin
  2. Paste the code into a mu-plugin file
  3. 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:

  1. WordPress database error: [Not unique table/alias: ‘wp_postmeta’]
  2. How much faster is a tax query than a meta query?
  3. Use custom posts as taxonomy term meta replacement?
  4. Is it possible to sort the post based on a custom field?
  5. List Custom Taxonomy Values according to a Post Meta Value
  6. Landing in 404 Page on Navigating to Custom Taxonomy Archive
  7. how to get title to custom tags page
  8. Getting yoast title for custom taxonomy
  9. get_the_terms() to show all custom taxonomies
  10. Single reusable value for post meta: Custom Taxonomy or Post Meta?
  11. need advice on how to do a lists using custom post types – taxonomy vs postmeta
  12. Current category link filter
  13. What is faster: custom taxonomy or serialized post-meta for db retrieval? (over 60,000 posts)
  14. Is it possible to store Json data in post_meta and manipulate
  15. Add Custom Taxonomy for Blog Meta Info
  16. How to separate posts in loop?
  17. Creating terms vs custom post meta to save data?
  18. Does using custom taxonomy is more CPU efficient than using meta_data?
  19. Output unique taxonomy terms of posts inside a loop
  20. Is it safe to register a taxonomy without using any hooks?
  21. wp_query not resetting, last post hanging
  22. how to get term id from current post type instead of name
  23. Count of posts by different parameters?
  24. WordPress sub taxonomy template
  25. Sort and paginate custom post taxonomies alphabetically
  26. WooCommerce custom taxonomy as meta?
  27. Sort taxonomy page alphabetically by meta rather than default post date
  28. Convert post meta to custom taxonomy?
  29. True or F False Setting of ‘with_front’ Parameter of Rewrite Is returning Exact Same result
  30. Get taxonomy link with post type slug prefix
  31. Count tags for current post and save into custom meta field (and update it on post edit)
  32. See double taxonomy inputs in WP editor
  33. setting a custom post type taxonomy term by code
  34. transfer two existing taxonomy terms into one custom metabox
  35. Is it possible to sort the post based on a custom field?
  36. Dynamic drop down of child terms and then drop down posts
  37. How to get list of custom taxonomies based on custom post type
  38. Custom post type term names with ampersand in the term name
  39. Looking for suggestions on creating simple database (Help!!)
  40. get meta fields and taxonomy of any post type
  41. How to make an sql query to exclude everything but custom taxonomy terms in table wp_terms?
  42. Update fields with post object and custom tax with wp_insert_post
  43. How can I show custom field according to taxonomy?
  44. How to associate string with individual use of taxonomy term
  45. Custom taxonomy with custom meta value is not sorting correctly (query returns the same value for orderby regardless of sort column click)
  46. How to handle custom taxonomy archive when no posts will have that taxonomy
  47. How can I list all the meta in a custom taxonomy?
  48. Trying to add taxonomy to get_categories() but it’s not working. How to fix this?
  49. Copy/clone/associate Custom field to Custom Taxonomy
  50. Proper WP conditional tag to check for existing taxonomies to list out terms with wp_list_categories?
  51. Problem with wordpress pagination
  52. Query posts using custom taxonomy and selected terms
  53. How to write sql query to get the posts from a custom taxonomy term name
  54. Foreach loop duplicating a taxonomy thumbnail image
  55. How to do a particular wp_query taxonomy search
  56. How to get custom category’s link?
  57. Edit custom taxonomy description programatically
  58. How to find taxonomy parent id from child taxonomy page?
  59. why are the term_id and term_taxonomy_id doesn’t match on custom taxonomies, but are duplicates on categories
  60. get_the_tags Conditional display of a custom taxonomy
  61. Removing “trashed” posts from post count in custom taxonomy terms?
  62. saving meta/custom field to tag
  63. Get only immediate children (and not grandchildren) of a hierarchical custom taxonomy term
  64. Proper use of wp_get_object_terms
  65. Remove a href from this code
  66. Why doesnt this query work? (Custom Taxonomy)
  67. Permalink Problems
  68. Get Terms for Page
  69. Adding a second custom taxonomy to a custom post type (both shown in its table)?
  70. custom post type, hide or disable the status line in publish meta box
  71. Take a custom taxonomy value and save as a standard Product Tag
  72. how to show records that don’t have custom meta value
  73. Set term on an attachment using wp_set_object_terms and want to display the full term text but it’s showing a slug instead
  74. Check If Taxonomy A and Taxonomy B has same Slug, 301 Auto Redirect Tax A to Tax B if True in WordPress
  75. how to get this tax_query working?
  76. Custom taxonomy archive page requires ?post_type= in url
  77. Multiple Custom Taxonomy Dropdowns Lists
  78. Restrict editing of posts with specific taxonomy to users with a matching meta value?
  79. Why isn’t the ‘no results’ being shown when a query returns no results?
  80. How to get_the_term_list() from multiple taxonomies?
  81. Load a certain functions file for a certain taxonomy
  82. link directly to custom post if there is only one in the taxonomy
  83. Ajax: Populate with content from a post’s ID not working – duplicating current page html instead
  84. How to support fifteen thousand terms in WordPress?
  85. Get taxonomy name for the current post
  86. Add a term to list in block editor taxonomy sidebar
  87. Output all terms in a custom taxonomy and add a “active” class only to the ones attached to the current post
  88. Show Taxonomies with admin area for custom post type?
  89. How to get posts that contain multiple terms from multiple taxonomies?
  90. Cannot delete or edit a single term in a custom taxonomy, taxonomy name is wrong?
  91. View the complete list of a taxonomy in the navigation menu
  92. How to group all terms children’s in custom taxonomy?
  93. Reverse order of posts in a certain taxonomy archive?
  94. My custom taxonomy page is leading in 404 page
  95. Running a function on post update with new post meta
  96. Display Posts by Custom Taxonomy Chosen Terms
  97. Include custom post type custom taxonomies in Categories widget
  98. Correctly order the hierarchy of custom taxonomy when displaying terms
  99. Show template part if part of term
  100. tax_query: Don’t show posts with parent term when they have a corresponding child term applied
Categories custom-taxonomy Tags custom-taxonomy, post-meta, theme-development
How to store and retrieve the attachment alignment?
rewriting for custom taxonomy rewrite

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress