first, you have to loop through all posts that have this meta key (your custom field) and then update post meta with replacing the word (from) to leave the number alone in the meta value.
//paste the following code in your plugin or theme functions.php
add_action( \'init\', function () {
if ( ! get_option( \'prefix_correct_data\' ) ) {
$metakey = \'YOUR_META_KEY\';
$loop = new WP_Query( [
\'meta_query\' => array(
array(
\'key\' => $metakey,
),
)
] );
if ( $loop->have_posts() ) {
while ( $loop->have_posts() ) {
$loop->the_post();
$old_meta = get_post_meta( get_the_ID(), $metakey, true );
update_post_meta( get_the_ID(), $metakey, str_replace( \'from\', \'\', $old_meta ) );
}
}
update_option( \'prefix_correct_data\', 1 );
wp_reset_postdata();
}
} );
this code cleans the meta value from the word (from). just change the meta key variable with yours
then you can run your wp_query
$posts = new WP_Query( [
\'post_type\' => \'post\',
\'meta_query\' => array(
\'key\' => \'price\',
\'compare\' => \'<=\',
\'value\' => 1000
),
] );
make sure to write the word (from) as you will find in the saved custom fields.
-- the first function will run one time only and you will have to change the option key to run it again --