Advanced Custom Fields

In Advanced Custom Fields the field editing screen where you add in the required fields and assign them to post edit screens did you choose image URL or Attachment ID for the image field? It sounds like you’ve got it set as image URL which will just return the URL to the originally uploaded file … Read more

How to create a metabox that will list all my pages in a dropdown selector?

You can use wp_dropdown_pages. For example add_action( ‘add_meta_boxes’, ‘myplugin_add_custom_box’ ); /* Adds a box to the main column on the Post edit screens */ function myplugin_add_custom_box() { add_meta_box( ‘myplugin_sectionid’, __( ‘My Post Section Title’, ‘myplugin_textdomain’ ), ‘myplugin_inner_custom_box’, ‘post’ ); } /* Prints the box content */ function myplugin_inner_custom_box( $post ) { $dropdown_args = array( ‘post_type’ … Read more

Automatically add a tag according to custom metadata

I accidentally found this question searching for something similar, and I liked your approach, so I improved your code a bit. I updated the action hook so it’s being triggered on save AND update. Added the wp_remove_object_terms to be able to switch back ( toggle ) custom meta box value ( in this case check-box … Read more

How to Display Custom Meta Box only on Specific Page IDs

A simple and cleaner solution would be to use !in_array ex: function mf_1_remove_meta_boxes() { if( !is_admin() && !isset( $_GET[‘post’] ) ) return; if( !in_array($_GET[‘post’], array(‘194′,’185′,’2’) ) ) remove_meta_box( ‘mf_1’, ‘page’, ‘normal’ ); } this way you can just add the ids in the array and as many as you want

Taxonomy as checkboxes

You need to make sure you cast all the terms as integers. Passing in strings will compare the id’s to the slugs, and end up creating new terms with the ids as the name. Edit Specifically, alter these two lines as follows (note the intval): wp_set_object_terms( $post_id, intval( $term ), $field[‘id’] ); … wp_set_object_terms( $post_id, … Read more

How to hide, and not to remove the attributes metabox?

The get_hidden_meta_boxes function (source link) provides two filters that you can use to hide the meta box. (Pick just one of them.) The first is default_hidden_meta_boxes (source), adding the metabox to the $hidden array will hide the metabox by default, but the user can select the screen options tab and choose to enable it. The … Read more

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