Title: graindepixel's Replies | WordPress.org

---

# graindepixel

  [  ](https://wordpress.org/support/users/graindepixel/)

 *   [Profile](https://wordpress.org/support/users/graindepixel/)
 *   [Topics Started](https://wordpress.org/support/users/graindepixel/topics/)
 *   [Replies Created](https://wordpress.org/support/users/graindepixel/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/graindepixel/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/graindepixel/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/graindepixel/engagements/)
 *   [Favorites](https://wordpress.org/support/users/graindepixel/favorites/)

 Search replies:

## Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[ACF Frontend Admin by DynamiApps] The Editor role cannot edit posts – 3.2.9.1 ok 3.2.9xxx no](https://wordpress.org/support/topic/the-editor-role-cannot-edit-posts-3-2-9-1-ok-3-2-9xxx-no/)
 *  Thread Starter [graindepixel](https://wordpress.org/support/users/graindepixel/)
 * (@graindepixel)
 * [1 month, 2 weeks ago](https://wordpress.org/support/topic/the-editor-role-cannot-edit-posts-3-2-9-1-ok-3-2-9xxx-no/#post-19003693)
 * With this update Version 3.29.13 the issue persists.
 * Permissions for an edit form: Administrator / Editor roles.
 * Administrator works perfectly for editing. Editor is blocked: “An error occurred.
   Please try again later.”
 * The issue is that the latest update is critical (Wordfence), so I have no choice
   but to apply it… and set my editors as administrators, which is quite risky.
 * If anyone has a solution, I’m all ears!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[ACF Frontend Admin by DynamiApps] The Editor role cannot edit posts – 3.2.9.1 ok 3.2.9xxx no](https://wordpress.org/support/topic/the-editor-role-cannot-edit-posts-3-2-9-1-ok-3-2-9xxx-no/)
 *  Thread Starter [graindepixel](https://wordpress.org/support/users/graindepixel/)
 * (@graindepixel)
 * [1 month, 3 weeks ago](https://wordpress.org/support/topic/the-editor-role-cannot-edit-posts-3-2-9-1-ok-3-2-9xxx-no/#post-18999469)
 * It’s the same story with the new version: (3.29.12 – 19-08-2026) it’s impossible
   to edit a post with a non-administrator role. I am really sorry Shabti :'(
    -  This reply was modified 1 month, 3 weeks ago by [graindepixel](https://wordpress.org/support/users/graindepixel/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[ACF Frontend Admin by DynamiApps] Galerie – image not attached to post](https://wordpress.org/support/topic/galerie-image-not-attached-to-post/)
 *  Thread Starter [graindepixel](https://wordpress.org/support/users/graindepixel/)
 * (@graindepixel)
 * [9 months, 1 week ago](https://wordpress.org/support/topic/galerie-image-not-attached-to-post/#post-18780087)
 * After a few hours of struggling, and given my inexperience, I tried using AI.
   Good chat, GPT, and Gemini wasted a lot of my time, but Claude found a solution
   in just a few prompts. I don’t know if it’s a permanent solution, but it works,
   or at least it’s a temporary fix. Please feel free to give me corrections and
   instructions, especially to avoid creating more problems.
 *     ```wp-block-code
       <?php/** * Sécurisation et attachement automatique des images de galerie * Pour Frontend Admin + ACF */// 1. Limiter les types de fichiers uploadables dans la galerieadd_filter('acf/upload_prefilter/name=galerie', 'restrict_gallery_file_types', 5, 3);function restrict_gallery_file_types($errors, $file, $field) {    // Types MIME autorisés pour les images    $allowed_types = array(        'image/jpeg',        'image/jpg',        'image/png',        'image/gif',        'image/webp'    );        // Vérifier le type MIME du fichier    if (!in_array($file['type'], $allowed_types)) {        $errors[] = 'Seules les images (JPEG, PNG, GIF, WebP) sont autorisées.';    }        // Vérification supplémentaire avec wp_check_filetype    $filetype = wp_check_filetype($file['name']);    if (!in_array($filetype['type'], $allowed_types)) {        $errors[] = 'Le type de fichier n\'est pas autorisé.';    }        return $errors;}// 2. Hook qui s'exécute quand ACF uploade un fichieradd_filter('acf/upload_prefilter/name=galerie', 'set_gallery_image_parent', 10, 3);function set_gallery_image_parent($errors, $file, $field) {    // Vérifier le nonce pour la sécurité    if (!isset($_POST['_acfnonce']) || !wp_verify_nonce($_POST['_acfnonce'], 'acf_nonce')) {        return $errors;    }        // Récupérer le post_id depuis les données du formulaire    $post_id = 0;    if (isset($_POST['post_id'])) {        $post_id = intval($_POST['post_id']);    } elseif (isset($_POST['acff']['post_id'])) {        $post_id = intval($_POST['acff']['post_id']);    }        // Vérifier que le post existe et que l'utilisateur a les permissions    if ($post_id > 0) {        $post = get_post($post_id);                // Vérifier que le post existe        if (!$post) {            return $errors;        }                // Vérifier les capacités de l'utilisateur        if (!current_user_can('edit_post', $post_id)) {            return $errors;        }                // Stocker temporairement le post_id pour l'utiliser après l'upload        add_filter('acf/upload_prefilter', function($errors) use ($post_id) {            global $temp_post_id_for_gallery;            $temp_post_id_for_gallery = $post_id;            return $errors;        });    }        return $errors;}// 3. Hook qui s'exécute après l'upload pour attacher l'imageadd_filter('acf/update_value/name=galerie', 'attach_uploaded_gallery_images', 10, 3);function attach_uploaded_gallery_images($value, $post_id, $field) {    // Vérifier que la valeur n'est pas vide    if (empty($value) || !is_array($value)) {        return $value;    }        // Vérifier que le post_id est valide    if (!is_numeric($post_id) || $post_id <= 0) {        return $value;    }        // Vérifier que le post existe    $post = get_post($post_id);    if (!$post) {        return $value;    }        // Vérifier les permissions de l'utilisateur    if (!current_user_can('edit_post', $post_id)) {        return $value;    }        // Parcourir et attacher les images    foreach ($value as $image_id) {        // Valider que c'est bien un ID numérique        if (!is_numeric($image_id) || $image_id <= 0) {            continue;        }                $image_id = intval($image_id);                // Vérifier que l'image existe et est bien une pièce jointe        if (get_post_type($image_id) !== 'attachment') {            continue;        }                // Vérifier que c'est bien une image (pas un PDF ou autre)        $mime_type = get_post_mime_type($image_id);        if (strpos($mime_type, 'image/') !== 0) {            continue;        }                // Vérifier que l'utilisateur peut éditer cette image        if (!current_user_can('edit_post', $image_id)) {            continue;        }                // Attacher l'image au post        wp_update_post(array(            'ID' => $image_id,            'post_parent' => $post_id        ));    }        return $value;}
       ```
   
 * Hopefully it will be viable 😮
    -  This reply was modified 9 months, 1 week ago by [graindepixel](https://wordpress.org/support/users/graindepixel/).
    -  This reply was modified 9 months, 1 week ago by [graindepixel](https://wordpress.org/support/users/graindepixel/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Better Post & Filter Widgets for Elementor] Basic problem : filter not working](https://wordpress.org/support/topic/basic-problem-filter-not-working/)
 *  Thread Starter [graindepixel](https://wordpress.org/support/users/graindepixel/)
 * (@graindepixel)
 * [11 months ago](https://wordpress.org/support/topic/basic-problem-filter-not-working/#post-18719405)
 * Dara….. You’re my hero of the day! I didn’t need a filter factory, and your plugin
   is just perfect, plus it’s packed with features for users. I dreamed of it, and
   Dara made it happen. A thousand sincere thanks; it will help us enormously with
   adoptions. The more user-friendly it is, the more likely we are to motivate people.
   A huge thank you. And thank you to Reddit, where I found the reference for this
   plugin ^_^
 * And thank you for the quick response; it’s priceless.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[HelloAsso] URL ou nom d’association invalide – campagnes](https://wordpress.org/support/topic/url-ou-nom-dassociation-invalide-campagnes/)
 *  Thread Starter [graindepixel](https://wordpress.org/support/users/graindepixel/)
 * (@graindepixel)
 * [12 months ago](https://wordpress.org/support/topic/url-ou-nom-dassociation-invalide-campagnes/#post-18682075)
 * C’est revenu dans l’ordre, à rien y comprendre 😮
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Prime Mover - Backup and Migration] Prime mover not activated](https://wordpress.org/support/topic/prime-mover-not-activated/)
 *  Thread Starter [graindepixel](https://wordpress.org/support/users/graindepixel/)
 * (@graindepixel)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/prime-mover-not-activated/#post-17996002)
 * First of all, thank you for the quality of the response, it is very, very complete.
   The 777 in emission was just the time to try, I immediately returned to 644.
 * I am a fan of prime mover because often the other solutions have all caused me
   problems. PM is the only plugin that is as flexible.
 * I managed after numerous attempts to find a solution thanks to an old backup 
   of my wp-config.php that I simply replaced. And that unblocked everything.
 * I still do not understand why the other sites are causing problems. But in my
   opinion I am good to redo a wp config.php on each one to unblock everything (
   if of course the problem comes from there).
 * Thanks again for the qualitative response (sorry my english so bad :p )

Viewing 6 replies - 1 through 6 (of 6 total)