validate_page() ) { return; } // load acf scripts acf_enqueue_scripts(); // actions add_action('admin_footer', array($this, 'admin_footer'), 10, 1); add_action('add_meta_boxes_comment', array($this, 'edit_comment'), 10, 1); } /* * edit_comment * * This function is run on the admin comment.php page and will render the ACF fields within custom metaboxes to look native * * @type function * @date 19/10/13 * @since 5.0.0 * * @param $comment (object) * @return n/a */ function edit_comment( $comment ) { // vars $post_id = "comment_{$comment->comment_ID}"; // get field groups $field_groups = acf_get_field_groups(array( 'comment' => get_post_type( $comment->comment_post_ID ) )); // render if( !empty($field_groups) ) { // render post data acf_form_data(array( 'screen' => 'comment', 'post_id' => $post_id )); foreach( $field_groups as $field_group ) { // load fields $fields = acf_get_fields( $field_group ); // vars $o = array( 'id' => 'acf-'.$field_group['ID'], 'key' => $field_group['key'], //'style' => $field_group['style'], 'label' => $field_group['label_placement'], 'edit_url' => '', 'edit_title' => __('Edit field group', 'acf'), //'visibility' => $visibility ); // edit_url if( $field_group['ID'] && acf_current_user_can_admin() ) { $o['edit_url'] = admin_url('post.php?post=' . $field_group['ID'] . '&action=edit'); } ?>