Display post by select it from a dropdown menu

To fix this issue, move the closing curly brace } for the foreach loop before the add_shortcode function, like this: function form_creation(){ ?> <select name=”page_id” id=”page_id”> <?php global $post; $args = array(‘cat’=>19); $posts = get_posts($args); foreach( $posts as $post ) : setup_postdata($post); ?> <option value=”<? echo $post->ID; ?>”><?php the_title(); ?></option> <?php endforeach; ?> <!– Move … Read more

Why can posts never have a number as the link?

Why Suffixes Are Appended to (Some) Numeric Post-Slugs WordPress posts can almost always have numeric permalinks, the exceptions being when they might conflict with another post, a feed, or a post post-type date archive, or are otherwise reserved. The wp_unique_post_slug() function mitigates these conflicts by appending a suffix. Potential date-archive conflicts arise when a numeric … Read more

Change permalinks in posts via SQL

If you are using MySQL 8 and above you can use REGEXP_REPLACE, e.i. UPDATE `wp_posts` SET post_content=REGEXP_REPLACE(post_content, ‘domain.tld\/[0-9]{4}\/[0-9]{2}\/[0-9]{2}\/’, ‘domain.tld/’) WHERE post_content REGEXP ‘domain.tld\/[0-9]{4}\/[0-9]{2}\/[0-9]{2}\/’; this would look for exact match domain.tld/{4 digit int}/{2 digit int}/{2 digit int}/ then replace it with domain.tld/ so it will replace something like domain.tld/2000/01/01/my-cool-post/ to domain.tld/my-cool-post/ Another option if you cannot … Read more

How to change url of posts?

You can customize your permalink structure to include “blogs” for posts. Here are the steps to do that: Go to your WordPress dashboard and click on “Settings” > “Permalinks”. Select the “Custom Structure” radio button. In the text field, enter “/blogs/%postname%/” (without the quotes). Click the “Save Changes” button. This will set the permalink structure … Read more