In a WordPress site, I want to remove the last 4 charaters (included space) in the rendered output of get_post_meta
.
Here is the PHP code, where I output the custom field named key
of a post:
global $wp_query;
$postid = $wp_query->post->ID;
echo get_post_meta($postid, 'key', true);
wp_reset_query();
Example:
If in a specific post, key
is My song title mp3
, the output will be My song title
because mp3
has been trimmed.