• Resolved sonmar

    (@soniamariano)


    Hi!

    I have created some custom post status, for the sake of workflow organization. After every newsletter sent, I want to change the post status of the posts I included in the newsletter from “Published” to “Sent”, so that they don’t show in the select article box when I’m composing the next email/newsletter). Problem is whenever I change a post status from “published” to any other post status, that post disappears from the page “view in browser” generated by each newsletter sent (the link that goes in all emailed newsletters). And this happens even when I set my custom post status to public:

    ‘public’ => true,
    ‘exclude_from_search’ => false,
    ‘show_in_admin_all_list’ => true,
    ‘show_in_admin_status_list’ => true,

    So, is there any way for me to exclude some posts from the select article box, without making them disappear from the newsletter archive? Many thanks in advance!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello,

    In the file wp-content/plugins/acymailing/back/dynamics/post/plugin.php line 334 we have a security to make sure the inserted post is published:

    AND post.post_status = "publish"

    You can remove this line to allow posts insertion of any type (it won’t touch at the posts shown in the insertion options nor the posts inserted by category).

    I’ll add an apply_filters hook before that to avoid having to do this modification each time you update AcyMailing.

    Thread Starter sonmar

    (@soniamariano)

    Hello,

    Thank you for your quick reply. I modified the line, so that it also includes my custom post status posts, like this

    AND (post.post_status = "publish" OR post.post_status = "my_custom_post_status")

    and it works as intended.

    But I would like to follow the best practices and don’t edit directly any plugin code. However, I’m not familiar with filters or hooks, so by any chance could you show me what php snippet should I add to my custom theme functions.php?

    Thank you once again.

    Thread Starter sonmar

    (@soniamariano)

    Hi,

    So, after the recent update, as expected, the direct modification to the plugin was gone. I now find a variable $allowedStatuses in the file wp-content/plugins/acymailing/back/dynamics/post/plugin.php (line 328) that sets which post status are shown in the newsletter archive page. But I can’t find any hooks or filters to safely edit that variable outside of the plugin files.

    Would you be so kind to give me some directions here?

    Many thanks.

    Hi,

    Something like this should work, add it where your other custom filters/actions are:

    add_filter('onAcymPostInsertion', 'my_function', 1);
    
    function my_function($statuses){
        $statuses[] = 'my_status';
        return $statuses;
    }

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Custom post status makes post disappear from view in browser page’ is closed to new replies.