Edit the post title from the frontend

Yes, you can change post title and slug from frontend. by using wp_update_post you can change title and slug of post. in below code, it will update post title and slug of post_id. Replace your-post-title-field with your title field in form. slug will generated using that post title. if ( isset( $_POST[‘my_image_upload_nonce’], $_POST[‘post_id’] ) && … Read more

Replace image name on upload to the new post name on front-end form

You can use sanitize_file_name filter to rename file. put this code in active theme’s functions.php, this will rename image filename as postname if only get title request. I have tested this code and it is working fine. Post name : https://prnt.sc/q3thzw Uploaded renamed image : https://prnt.sc/q3tib7 function make_filename_as_post_name($filename) { $info = pathinfo($filename); $ext = empty($info[‘extension’]) … Read more

What is $post->pre_post_content exactly?

There’s no such thing. pre_post_content is a filter that allows you to filter the result of sanitize_post_field() for the post_content field of posts. But the standard WP_Post class, which $post usually is, does not have a pre_post_content field. If $post on your site has such a field, then it’s likely being added by a plugin, … Read more

Why is my custom template not showing anything?

The template for displaying all your posts should not be a custom page template. You should set the page you want to use as your Posts page in Settings > Reading. Then, as per the Template Hierarchy, your theme will automatically use home.php for this page, or index.php if that does not exist. So you … Read more

Force a specific template as default

Instead of setting yourtemplate.php as the default, why don’t you change the default template, and put the original default in yourtemplate.php? AKA swap them? Otherwise you’ll have to go back through all your posts and change them, and, mess around with complicated filters that might not work 100%

my post slug gets really long and I can’t change it

This is because you’re using characters that aren’t valid in URLs: קידום-מנצח URLs only allow a limited subset of ASCII characters In order for these characters to work in a URL, they have to be encoded. For example if I visit example.com/foo bar/ the space isn’t valid in URLs, so it gets turned into example.com/foo%20bar/, … Read more