How to remove the RichText Meta Box

Unfortunately, it’s not possible to remove it like a metabox, since it isn’t one. However, there’s a very easy way to get rid of it for a custom post type. If you don’t define anything for the ‘supports’ argument in the registration function, your post type will default to ‘supports’ => array( ‘title’, ‘editor’ ), … Read more

How to List all Sidebars in a Metabox

Try this: <?php $sidebar_options = array(); $sidebars = $GLOBALS[‘wp_registered_sidebars’]; foreach ( $sidebars as $sidebar ){ $sidebar_options[] = array( ‘name’ => $sidebar[‘name’], ‘value’ => $sidebar[‘id’] ); } ?> This prints out( with my registered sidebars ): Array ( [0] => Array ( [name] => Language Menu [value] => sidebar-1 ) [1] => Array ( [name] => … Read more

Conflicting save_post functions when passing the post id and saving custom meta boxes for different post types

After doing some more research I found that: Instead of hooking the add_meta_box function into admin_menu it should be hooked into add_meta_boxes Instead of the foreach loop use the update_post_meta function on the save function Instead of using the wp_nonce_field the data can be sanitized using esc_attr and strip_tags To pass the post id to … Read more

meta content on required pages

After too many tries i have found following solution myself, but this could save others time. $pid = (isset($_GET[‘post’]) ? $_GET[‘post’] : $_POST[‘post_ID’]); $page_att = get_page( $pid ); $page_parent = $page_att->post_parent; if(15 == $page_parent){ //register metabox }

How to add a select menu to this metabox code?

Basically you need to add the html of the select dropdown at your function inventory_information() which is the function that actually displays the metabox: // The Event Location Metabox function inventory_information() { global $post; // Noncename needed to verify where the data originated echo ‘<input type=”hidden” name=”inventorymeta_noncename” id=”inventorymeta_noncename” value=”‘ . wp_create_nonce( plugin_basename(__FILE__) ) . ‘” … Read more

WordPress metabox file upload in custom post [duplicate]

For WordPress metabox file upload in custom post. please refer Below link http://code.tutsplus.com/articles/attaching-files-to-your-posts-using-wordpress-custom-meta-boxes-part-1–wp-22291 or you can use following plugins https://wordpress.org/plugins/simple-fields/ http://www.advancedcustomfields.com/ both plugin best for custom field . you can also create reapeatable fields

Validation Function for URL in plugin

I would look into PHP’s parse_url() and/or filter_var() with FILTER_VALIDATE_URL filter. parse_url() gives you a bit more control. Combine that with a sanitization as mentioned at the end. Here are couple use cases that will hopefully give you a better idea on how to proceed: If you want to verify that the url’s domain is … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)