upload file with front-end submission and forward the data in an email

In case anyone needs this, here is my solution: if ($_FILES) { function insert_attachment($file_handler, $post_id, $setthumb = ‘false’) { if ($_FILES[$file_handler][‘error’] !== UPLOAD_ERR_OK) __return_false(); require_once(ABSPATH . “wp-admin” . ‘/includes/image.php’); require_once(ABSPATH . “wp-admin” . ‘/includes/file.php’); require_once(ABSPATH . “wp-admin” . ‘/includes/media.php’); $attach_id = media_handle_upload( $file_handler, $post_id ); //get url $attachment_url = wp_get_attachment_url($attach_id); add_post_meta($post_id, ‘_file_paths’, $attachment_url); $attachment_data = … Read more

How do I embed youtube video via url in frontend posting

WordPress supports quite a few embeds including YouTube since WordPress 2.9. To render anywhere, just pass your content through the_content filter and it should automatically convert the urls. $oembedContent = apply_filters( ‘the_content’, $basicContent ); If the defaults don’t meet your needs you can add an oEmbed-Enabled site using wp_oembed_add_provider( $format, $provider, $regex ) or add … Read more

User count only for role frontend vendor

to get the number of authors who are assigned a particular role the get_users() function should do it: $args = array( ‘role’ => ‘frontend_vendor’,//substitute your role here as needed ‘fields’ => ‘ID’, ); $users = get_users( $args ); $user_count = count( $users );

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