Replace Unwanted Space in Post Content URL

I think you should run this query. To replace space with dash. update wp_posts set wp_posts.post_name = REPLACE( wp_posts.post_name, ‘ ‘, ‘-‘ ); Don’t forget to change table_prefix in this. And also, keep a backup on current database before trying.

wpdb LIKE request shows all database data

Can you verify that $_POST[‘name’] is obtaining a value. I suggest echoing it out to the page for debugging (maybe in comment tags if site is live). If $_POST[‘name’] is empty, then all results will be returned because the query will say user_nicename LIKE ‘%’ Just as a precaution in any case, you should do … Read more

Query WordPress Database and Post HTML Table

$html= “<table>”; foreach($result as $r){ $html .=”<tr>”; $html .=”<td>”.$r->post_title.”</td>”; $html .=”<td><a href=””.get_the_permalink($r->ID)””>”.$r->post_title.”</a></td>”; $html .=”</tr>”; } $html .=”</table>”; echo $html; To avoid the depreacated usage of PHP code snippets you can wrap it in a shortcode and use anywhere in a page/post content editor function Stack_308511_post_grid( $atts ) { $atts = shortcode_atts( array( ‘limit’ => 10, … Read more

Delete posts with word count less than x number of words

function delete_posts() { $lastposts = get_posts(array(‘numberposts’ => -1)); if ( $lastposts ) { foreach ( $lastposts as $post ) : setup_postdata( $post ); ?> <?php $content = get_the_content(); if (str_word_count($content) < 100) { wp_trash_post($post->ID); } ?> <?php endforeach; wp_reset_postdata(); }}add_action( ‘init’, ‘delete_posts’ );

How to get EVENT based on startday, using BETWEEN

found the solution <3 Used WHERE ‘$startday’ BETWEEN dstart AND dend plus : OR dstart >= ‘$startday’ SELECT * FROM wp_posts, wp_mec_dates AS mecd, wp_icl_translations WHERE wp_posts.ID = mecd.post_id and post_status=”publish” AND wp_icl_translations.language_code=”$lang” AND (‘$startday’ BETWEEN dstart AND dend OR dstart >= ‘$startday’) AND wp_posts.ID = wp_icl_translations.element_id ORDER BY dstart LIMIT 0,6

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)