• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
Foster Solutions (FSI)

Foster Solutions (FSI)

The Solution is in the Process

  • Home
  • What We Do
    • Websites / Hosting
      • Author’s Sites
      • Boutique Websites
      • Corporate Websites
      • Open Source CMS
      • Quick and Dirty Websites
    • SQL Databases / VBA Automation
    • GIS / Market Research
    • Government/Planning
  • Case Studies
    • Databases/Automation Case Studies
    • GIS/Market Research Case Studies
    • Local Government Case Studies
    • FSI – crosspollination – examples
  • Clients
  • Articles
  • Contact Us

Changing Media Attachment in WordPress (SQL)

WordPress seems limited with the way it handles images (media).  I don’t see why it can’t be part of the taxonomy like posts and pages since it is stored in the wp_posts table. 

A media item is “attached” to a post if it has a value in the post_parent field.  It can only be attached to one post. 

If you have a gallery in a post and need to move them the only way to do it is via sql in the MySQL db. 

Here is the sql to update in bulk media records to a new “parent.”  You need the post ID for both the post you are moving from to the one you are moving to….

update wp_posts t1 set t1.post_parent = 713 where post_parent = 444 and post_type = ‘attachment’

Ready to get started?

Client Survey

Please take this survey if you are interested in a new or modified website. We will assess and get back with you as soon as possible.


Finding Solutions

We work with you to make things faster, easier and better.

Sites

  • Home
  • Blog
  • About
  • Features
  • Contact
  • Marketing

Features

  • Home
  • Blog
  • About
  • Features
  • Contact
  • Marketing

Support

  • Home
  • Blog
  • About
  • Features
  • Contact
  • Marketing

Copyright © 2022 · Foster Solutions (FSI) · All Rights Reserved

Back to top