Update ACF fields on a frontend form? [closed]
You want to use update_field to save the content.
You want to use update_field to save the content.
Use wp_handle_upload in a custom function if ( $_FILES ) { upload_user_file($_FILES[‘test_upload’]); } if ( ! function_exists( ‘upload_user_file’ ) ) : function upload_user_file( $file = array(), $title = false ) { require_once ABSPATH.’wp-admin/includes/admin.php’; $file_return = wp_handle_upload($file, array(‘test_form’ => false)); if(isset($file_return[‘error’]) || isset($file_return[‘upload_error_handler’])){ return false; }else{ $filename = $file_return[‘file’]; $attachment = array( ‘post_mime_type’ => $file_return[‘type’], ‘post_content’ … Read more
Displaying comment status is quite standard in every theme; maybe you have not been notice it but you have seen it for sure. All default themes do it and the default wp_list_comments() function does it also and it is the most common function used to display posts comments. So, if you use default wp_list_comments(), you … Read more
You just want a meta_query based on the current page’s ID: $query = new WP_Query( array( ‘post_type’ => ‘sidebar_boxes’, ‘posts_per_page’ => -1, ‘orderby’ => ‘menu_order’, ‘order’ => ‘ASC’, ‘meta_query’ => array( ‘key’ => ‘checkfieldBox’, ‘value’ => $post->ID, ) ) ); You can really only depend upon $post in the way I did on “singular” pages … Read more
you don’t have to edit the order-details.php page the woocommerce_order_details_after_order_table action will achieve the same results. add_action( ‘woocommerce_order_details_after_order_table’, ‘namespace\custom_field_display_cust_order_meta’, 10, 1 ); function custom_field_display_cust_order_meta( $order ) { echo ‘<form [whatever]>’; /* translators: whatever */ echo ‘<p>’ . sprintf( __( ‘<strong>Property 1:</strong> %1$s (%2$s)’ ), ‘<input [whatever]>’ . get_post_meta( $order->get_order_number(), ‘property 1.1’, true ) . ‘</input>’, … Read more
You’ll need to add brackets to the name of your multiple input form element for PHP to interpret it as an array. <input type=”file” multiple name=”thumbnail[]” id=”thumbnail”> You’ll then get an array named ‘thumbnail’ with 5 arrays within it. See this comment on php.net for a breakdown of the structure. Edit: Notice the difference in … Read more
it doesn’t open it when I click on the link in page source. It just refreshes the page source page Are you sure? Sounds like you’re getting the source for a WordPress 404 page. My spidey senses detect this is the problem: plugin_dir_url( ‘front-end-editor/build/’ ) . ‘editor.js’ …which isn’t quite how it should be used … Read more
wp_insert_post() returns either one of three things the newly created post’s ID a WP_Error object if $wp_error is set to true if an error occured during post insertion in which case the post is not inserted 0 if $wp_error is set to false (default) if an error occured during post insertion in which case the … Read more
This sounds like the wrong way around and always having the danger of forgetting or misconfiguring something. If you need content separation, just use a network install. It has a little more overhead of admin but it out of the box ensures the content separation you seek.
After add_post_meta($post_id, ‘_standard_image’, trailingslashit($uploaddir[‘url’]) . $filename); paste set_post_thumbnail($post_id, $attach_id); What this is doing is taking the attachment that is created in this function and adding it as a featured image. Hope that helps.