Programmatically insert hierarchical terms & set terms for post causes glitch? [duplicate]

This question already has answers here: Inserting terms in an Hierarchical Taxonomy (7 answers) Closed 8 years ago. I am inserting an array of terms into my custom taxonomy programmatically. Some terms have parents/children. After each term has been entered, I then insert an array of posts into my custom post type. After inserting each … Read more

WordPress gallery previous/next buttons showing all media library images

I have just noticed that on my installation of wordpress, within the gallery image pages, the previous/next buttons are browsing through my entire media library rather than just those images that are in the designated gallery. This means that users are able to scroll through images that are used for other purposes. Is there a … Read more

WP_Query and using a variable for ‘cat’=> in the args array = WP Bug?

For the sake of this discussion, here’s a version of my query within category.php: wp_reset_query(); $category_id = get_cat_ID(single_cat_title(”, false)); $my_query = new WP_Query(array( ‘posts_per_page’ => SOME_DEFINED_VALUE, ‘cat’ => $category_id, ‘paged’ => ( get_query_var(‘paged’) ? get_query_var(‘paged’) : 1 ), ‘post_type’ => array(‘post’,’post_custom_1′,’post_custom_2′,’post_custom_3′) )); // print_r($my_query); In short, it doesn’t work. Here’s what I’ve noticed. When I … Read more

wp_enqueue_script with dependencies doesn’t work

I’m having this code: wp_register_script(‘parent’,’parent.js’, array(‘child’), ‘1’, true); wp_register_script(‘child’, ‘child.js’, array(‘grandchild’), ‘1’, true); wp_register_script(‘grandchild’, ‘grandchild.js’, array(), ‘1’, true); wp_enqueue_script(‘parent’); and it works fine, rendering grandchild.js, then child.js, then parent.js in footer. Every combination of just parent and child works fine, regardless of TRUE or FALSE ‘render in footer’. But when I register ‘child’ to be … Read more

How can I set status=’publish’ for all featured images?

Background: I’ve come accross this WP issue: https://core.trac.wordpress.org/ticket/41445 In short: when you make a request to a post over the REST API, if the featured image was originally uploaded to a different post and this post is not accessible via the REST API (eg. the original post is trashed, is a draft, etc), you get … Read more

get_template_directory_uri does not seem to work when defining WP_CONTENT_DIR

I have defined in my config: define( ‘WP_CONTENT_DIR’, dirname(__FILE__) . ‘/somedirectory’ ); after Codex: Editing WP Config BUT <?php echo get_template_directory_uri(); ?> prints out: http://dev.domain.com/wp-content/themes/mytheme Even though it should print out http://dev.domain.com/somedirectory/themes/mytheme Has anyone else experienced this or know of a fix? 1 Answer 1 This is how i set my content directory in wp-config.php … Read more

How can you receive the most recent permalink or terms of the newly saved post?

When using the Gutenberg Block Editor the normal hooks for saving a post don’t have the same behavior as with the classic editor. pre_post_update save_post wp_insert_post For example, if you hook into the save_post-hook the $permalink and the $categories will not return the new value, but instead the old value. Which is not the behavior … Read more

No longer able to attach S3 bucket files to emails being sent by WordPress due to PHPMailer security update

I’ve been trying to track down why my s3 bucket files are no longer being attached to automated emails being sent out by WordPress (using the Gravity Forms Entry Automation plugin). I’ve been able to identify the latest version of PHPMailer being the reason why the attachments no longer get added. From the PHPMailer ticket … Read more