• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Yoast / wordpress-seo / 8218b111533b92ec47f94130a94bcd0102263a45

01 Dec 2025 09:48AM UTC coverage: 53.092%. First build
8218b111533b92ec47f94130a94bcd0102263a45

push

github

web-flow
Merge pull request #22759 from Yoast/feature/task-list

Feature/task list

8697 of 16050 branches covered (54.19%)

Branch coverage included in aggregate %.

98 of 605 new or added lines in 51 files covered. (16.2%)

32413 of 61381 relevant lines covered (52.81%)

46976.02 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/task-list/application/tasks/create-new-content.php
1
<?php
2
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure.
3
namespace Yoast\WP\SEO\Task_List\Application\Tasks;
4

5
use Yoast\WP\SEO\Helpers\Post_Type_Helper;
6
use Yoast\WP\SEO\Task_List\Domain\Components\Call_To_Action_Entry;
7
use Yoast\WP\SEO\Task_List\Domain\Components\Copy_Set;
8
use Yoast\WP\SEO\Task_List\Domain\Tasks\Abstract_Task;
9

10
/**
11
 * Represents the task for creating new content.
12
 */
13
class Create_New_Content extends Abstract_Task {
14

15
        /**
16
         * Holds the id.
17
         *
18
         * @var string
19
         */
20
        protected $id = 'create-new-content';
21

22
        /**
23
         * Holds the priority.
24
         *
25
         * @var string
26
         */
27
        protected $priority = 'medium';
28

29
        /**
30
         * Holds the duration.
31
         *
32
         * @var int
33
         */
34
        protected $duration = 90;
35

36
        /**
37
         * Holds the post type helper.
38
         *
39
         * @var Post_Type_Helper
40
         */
41
        private $post_type_helper;
42

43
        /**
44
         * Constructs the task.
45
         *
46
         * @param Post_Type_Helper $post_type_helper The post type helper.
47
         */
NEW
48
        public function __construct( Post_Type_Helper $post_type_helper ) {
×
NEW
49
                $this->post_type_helper = $post_type_helper;
×
50
        }
51

52
        /**
53
         * Returns whether this task is completed.
54
         *
55
         * @return bool Whether this task is completed.
56
         */
NEW
57
        public function get_is_completed(): bool {
×
NEW
58
                if ( ! \in_array( 'post', $this->post_type_helper->get_public_post_types(), true ) ) {
×
NEW
59
                        return true;
×
60
                }
61

NEW
62
                $recent_posts = \get_posts(
×
NEW
63
                        [
×
NEW
64
                                'post_type'      => 'post',
×
NEW
65
                                'post_status'    => 'publish',
×
NEW
66
                                'numberposts'    => 1,
×
NEW
67
                                'date_query'     => [
×
NEW
68
                                        [
×
NEW
69
                                                'after' => '30 days ago',
×
NEW
70
                                        ],
×
NEW
71
                                ],
×
NEW
72
                        ]
×
NEW
73
                );
×
74

NEW
75
                return ! empty( $recent_posts );
×
76
        }
77

78
        /**
79
         * Returns the task's link.
80
         *
81
         * @return string|null
82
         */
NEW
83
        public function get_link(): ?string {
×
NEW
84
                return \self_admin_url( 'post-new.php' );
×
85
        }
86

87
        /**
88
         * Returns the task's call to action entry.
89
         *
90
         * @return string|null
91
         */
NEW
92
        public function get_call_to_action(): Call_To_Action_Entry {
×
NEW
93
                return new Call_To_Action_Entry(
×
NEW
94
                        \__( 'Create new post', 'wordpress-seo' ),
×
NEW
95
                        'add',
×
NEW
96
                        $this->get_link()
×
NEW
97
                );
×
98
        }
99

100
        /**
101
         * Returns the task's copy set.
102
         *
103
         * @return string|null
104
         */
NEW
105
        public function get_copy_set(): Copy_Set {
×
NEW
106
                return new Copy_Set(
×
NEW
107
                        \__( 'Create new content', 'wordpress-seo' ),
×
NEW
108
                        \__( 'Long gaps without new content slow down your traffic growth. Publishing regularly gives search engines and visitors a reason to return.', 'wordpress-seo' ),
×
NEW
109
                        \__( 'Plan a topic, write your post, and use the SEO and Readability Analyses to refine it before publishing.', 'wordpress-seo' )
×
NEW
110
                );
×
111
        }
112
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc