WordPress links only showing as text on main blog page

By default, WordPress removes all HTML from automatic excerpts, preventing links from being displayed. To include links or other HTML elements in excerpts, you can set manual excerpts by simply adding the desired tags. If setting manual excerpts for each post isn’t feasible, you may consider using a plugin to customize excerpts automatically.

Adding a new custom post type using the editor causes 502 bad gateway error

I did some further research and testing, and found the issue to be related to nginx and not WordPress itself. The following Stack Overflow post included some configuration adjustments for the site’s config file that resolved the 502 bad gateway issues. My configuration file’s client_max_body_size was already set to 64M. Here are the nginx settings … Read more

Object of class WP_Filesystem_Direct could not be converted to string

In here: $filesystem = new WP_Filesystem_Direct( false ); $server = getcwd(); $path = $server . ‘/wp-content/uploads/on_this_day.txt’; $filesystem->get_contents($path); echo $filesystem; …note that $filesystem, in the last line, is the same variable that’s holding your WP_Filesystem object. Try this instead: $filesystem = new WP_Filesystem_Direct( false ); $server = getcwd(); $path = $server . ‘/wp-content/uploads/on_this_day.txt’; $file_content = $filesystem->get_contents($path); … Read more

Why is sanitize_text_field() selectively trimming data?

Can anyone explain it? The official docs for that function say it strips percent encoded characters. Checks for invalid UTF-8, Converts single < characters to entities Strips all tags Removes line breaks, tabs, and extra whitespace Strips percent-encoded characters https://developer.wordpress.org/reference/functions/sanitize_text_field/ It looks like it’s stripped out %ad and it has nothing to do with instances … Read more

how to execute a function only when i send an order to trash [closed]

It depend if you’re using HPOS or not: If not: function my_custom_function_on_order_trash( $post_id ) { // Get the post type of the trashed item $post_type = get_post_type( $post_id ); // Check if the trashed item is an order if ( ‘shop_order’ === $post_type ) { // Your custom code here } } add_action( ‘wp_trash_post’, ‘my_custom_function_on_order_trash’ … Read more

Draft standard post by ACF Data picker

This code works perfectly! function delete_expired_posts() { $args = array( ‘post_type’ => ‘post’, ‘meta_query’ => array( array( ‘key’ => ‘fecha_borrado’, ‘compare’ => ‘EXISTS’, ), ), ‘posts_per_page’ => -1, ); $query = new WP_Query($args); if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); $post_id = get_the_ID(); $acf_date = get_field(‘fecha_borrado’, $post_id); $acf_timestamp = strtotime($acf_date); $current_timestamp = time(); if ($acf_timestamp … Read more

How to add placeholder into comment form textarea?

Use the filter comment_form_fields instead of comment_form_defaults. Also, in the call to str_replace(), remove the =”” from required in both strings. So, your code will become: function custom_comment_form_placeholders( $fields ) { if ( isset( $fields[‘comment’] ) ) { $fields[‘comment’] = str_replace( ‘<textarea id=”comment” name=”comment” cols=”45″ rows=”8″ maxlength=”65525″ required></textarea>’, ‘<textarea id=”comment” name=”comment” cols=”45″ rows=”8″ maxlength=”65525″ required … Read more