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

Remove href tag from wp_postmeta in 34,000 posts?

Firstly, I would consider using one of WordPress’ wp_kses-like functions, instead of PHP’s strip_tags().

Secondly, query your posts with WP_Query or get_posts() with the fields parameter set to ids – seems like you don’t need more than that.

Thirdly, split up your loop into steps that are effective and manageable. Because 34000+ posts will likely reach the limits of your server – at the very least regarding processing time.

You could for example make smart use of the posts_per_page and/or offset parameters for WP_Query/get_posts. Or you might do it by handling the complete array of IDs you can get by setting posts_per_page to -1 another way with PHP. For an exemplary approach take a look at the following answer by @TheDeadMedic on a similar matter.

Related Posts:

  1. Why is wp_kses not keeping style attributes as expected?
  2. Order tags, but not alphabetically
  3. WordPress: Can I add categories/tags to all sites in my network at once?
  4. How to Get Next or Previous Post in a Specific Tag?
  5. How do I display a tag cloud under my post that only shows tags from that post?
  6. Display list of most used tags in the last 30 days
  7. Check if current page has given tag ID
  8. how do I get the tag name from tag id?
  9. Do tags have dates?
  10. Checklist of selected categories
  11. Stop wordpress from removing HTML attributes
  12. What is the difference between terms and tags?
  13. Stop WordPress From Removing HTML Comments In Content
  14. How can I let my audience tag my posts?
  15. Display tags in list without link
  16. how can I use WP_Query to exclude a specific tag.?
  17. How can you tie into the tag metabox?
  18. not functioning
  19. How to use the Tag description as the title attribute?
  20. Best way to show map of tagged posts?
  21. How to display the_tags() as plain text
  22. Remove a particular tag name from the tagcloud
  23. How do I change the output of get_the_tag_list()?
  24. Query all posts with specific tag
  25. How to query with get_posts() for posts with any tag
  26. How to remove Tags: text from the_tags?
  27. Change tooltip in tag cloud
  28. Getting an ordered list of tags – via wp_tag_cloud or not?
  29. Is it possible to filter get_adjacent_post() with tags?
  30. Apply class to the a tag link generated in post tag links
  31. What are allowedposttags and allowedtags?
  32. Display tags for current post in sidebar
  33. How to allow user to perform search by more than one tag
  34. When switching from html to visual editor the tag gets erased
  35. How important are WordPress tags for SEO purposes?
  36. get_post_ancestors returns empty
  37. Combining tags from post types
  38. Display tags belonging to a specific post type only
  39. Allow visitors to search by multiple tags (specific IDs)
  40. List ‘n’ number of posts from a Tag, each with a different class or ID
  41. Showing all tags in admin -> edit post
  42. Redirect Tag to Post with the same name
  43. Add exception for specific tag
  44. Creating a Lightweight Media Tags Plugin with a Custom Taxonomy
  45. Link from tags to tag pages displaying all posts with that tag
  46. Displaying the most recently used tags
  47. Limit tag word count
  48. When are tags counted? Can it be trigered manually?
  49. How can I extend Quick Edit option with 2 more fields
  50. Can’t Get ‘tag’ Page To Display only Tagged Posts
  51. How to separate the tags?
  52. alt attributes not showing on pages
  53. Creating a unique, linked list of tags from a specific category?
  54. Massive Tags Remove Using MySQL
  55. Add # before each tag
  56. Quicktags on all textarea.. Not working on plugin?
  57. term/tag not being saved for custom post type
  58. display tag slug as class per link in tag cloud
  59. how to change # of tag posts on /tag page?
  60. require one tag for each post
  61. How can I remove certain HTML tags from the RSS feed?
  62. Stop WordPress removing tags when switching from HTML to Visual (TinyMCE)
  63. WP API Get post with tag names instead of tag ID’s
  64. How to add class on term link?
  65. Link directly to the first post in an archive
  66. Set homepage to only display posts from one tag
  67. get_terms with more than x post count
  68. Tags as a dropdown with set tags
  69. Why ‘C++’ tag is converted to ‘C# ‘?
  70. Change the color of post title on specific tags
  71. How to show tags in posts, orderby count(most used) not alphabetically?
  72. Individual css class for each tag in wp_tag_cloud
  73. Strict tag list – user should choose only existing tags for posts
  74. How to use meta data for each tag cloud a
  75. Is there a way to list tags order by post_meta field
  76. Special characters in tag get removed for comparison on save
  77. Exclude a specific tag from the get_the_tags list
  78. Display all posts of current viewing tag
  79. Limit tag cloud terms by date
  80. Efficient Tag Management?
  81. Exclude specific tags (by id) from the_tags
  82. Display custom list of tags in post/page editor with hooks
  83. Is is possible to rebuild wp_term_relationships table?
  84. Get the latest tags in a cloud? [closed]
  85. Sort list of WordPress Page under tag when is_tag() called
  86. How to remove ‘noindex, follow, max-image-preview:large’ in search page WordPress 5.7 up
  87. Displaying Posts by tag dynamically in WordPress
  88. Order tags by the order they were typed
  89. URL scheme to retrieve tag archive by ID
  90. How to rename ‘TAG’ to ‘TOPIC’
  91. How to not show tags if the post doesn’t have any?
  92. How to get all tags collections in woocommerce?
  93. In need of array of post tags
  94. Get the tags as an array, convert the tag into a string, and then replace spaces with dash
  95. Tag with Alias capability
  96. Don’t show a tag on a post if it is the only post with that tag
  97. How to filter posts by specific date and its tag
  98. Setting a value on existing tag metadata field when that tag was just created by a user
  99. How to remove tag base from permalinks
  100. Query all posts which do not have tags assigned to them
Categories tags Tags post-meta, tags
Only display post if published in last 24 hours?
How to get authors avatar

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