ap_update_post_attach_ids( integer $post_id )

Description #

Update post attachment IDs.

Parameters #

  • $post_id
    integer (Required) Post ID.

Source #

File: includes/qameta.php

function ap_update_post_attach_ids( $post_id ) {
	global $wpdb;

	$ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} where post_type = 'attachment' AND post_parent = %d", $post_id ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery

	$insert = ap_insert_qameta( (int) $post_id, array( 'attach' => $ids ) );
	return $ids;
}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment