_migrate_image( int $post_id, string $type )

Migrate the attachment image id from the legacy post meta location to the WP core’s featured image.


Parameters Parameters

$post_id

(int) (Required) WP_Post ID.

$type

(string) (Required) Award type, either "achievement" or "certificate".


Top ↑

Return Return

(bool) true if there was an image to migrate, else false.


Top ↑

Source Source

File: includes/functions/updates/llms-functions-updates-600.php

function _migrate_image( $post_id, $type ) {

	$image_migrated = false;
	$image          = get_post_meta( $post_id, "_llms_{$type}_image", true );
	if ( $image ) {
		set_post_thumbnail( $post_id, $image );
		$image_migrated = true;
	}

	delete_post_meta( $post_id, "_llms_{$type}_image" );

	return $image_migrated;
}

Top ↑

Changelog Changelog

Changelog
Version Description
6.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.