I see that you guys might have solved this issue in the comments, but others might end up here, looking for an answer, so let\'s give it to them! :)
As pointed out by Michael, the problem here is that you didn\'t echo out the content. But there are also some other issues that should be fixed.
Whenever you are outputting or saving anything in WordPress, make sure you escape it. This is one of the parts of the WordPress Coding Standards, a set of rules made to keep a level of quality and consistency in your code.
In your functions.php
, change this:
<h3><?php homepage_fields_get_meta(\'homepage_fields_banner_text\'); ?></h3>
to this:
<h3><?php echo esc_html(homepage_fields_get_meta(\'homepage_fields_banner_text\')); ?></h3>
The function esc_html
escapes a string from any bad characters, so that you can use it in html without anything breaking.
In the metabox plugin code, replace
_e( \'Banner Text\' );
With
esc_html_e( \'Banner Text\' );
The function esc_html_e
displays translatable strings, escaped, safe to use in html.
On the row below
<input type="text" name="homepage_fields_banner_text" id="homepage_fields_banner_text" value="<?php echo homepage_fields_get_meta( \'homepage_fields_banner_text\' ); ?>" size="30" />
The function esc_attr
escapes strings to be safe to use as attributes.
<input type="text" name="homepage_fields_banner_text" id="homepage_fields_banner_text" value="<?php echo esc_attr(homepage_fields_get_meta( \'homepage_fields_banner_text\' ) ); ?>" size="30" />
Good read:
Check out the guide for data sanitization and escaping on WordPress.org.