PHP variable not regenerating when publishing multiple posts at the same time

Context: I am building an automated system which will grab record from a database and immediately publish them en masse as a CPT. When they are being published, I have a function in the functions.php file of a child theme that should automatically set two categories to the post, a “fixed” one called ‘People’, and another one based on a column (categ) which is part of the record sent with the post.

Duplicate posts when posting nulls in records in phpMyAdmin

I have a phpMyAdmin database with a table whose contents, when inputted from the database, automatically publish the related information. Some of the details within the record may be NULL, and while testing I encountered the issue that if any of the content within any record is NULL, all the records are duplicated when reloading … Read more

Snippet displaying LearnDash parent course title with lesson title

I am using LearnDash on my WordPress site, and have created the following snippet to get a list of all lessons: function get_list_of_lessons_class(){ $args = array( 'post_type' => 'sfwd-lessons', 'posts_per_page' => -1, 'post_status' => 'publish', ); $q = new WP_Query($args); if ($q->have_posts()) : while ($q->have_posts()) : $q->the_post(); the_title(); endwhile; else: ; wp_reset_postdata(); endif; return $finalout; … Read more

Different number posts per page based on custom post type term id

Trying to cobble together a function from various suggestions that sets the number of posts per page based on the custom post type category in question. For instance, an “Alphabetical” category contains 3500+ posts, so I want pagination, but a child category “A” contains 100 posts and I want to show them all without pagination. The term_id for “A” is 1858, for “Alphabetical” is 1853. Can I check for specific term ids in a conditional? Not like this of course, which was just guessing…