Add URL to selected post in meta box

Super short version: Replace $post->post_title with get_permalink($post->ID). Short version: Add a filter to your current Code, where you output the post_title. $posts = get_posts(array(‘post_type’=> ‘lesson’, ‘post_status’=> ‘publish’, ‘suppress_filters’ => false, ‘posts_per_page’=>-1)); //here you add the HTML of the dropdown you add something like echo ‘<p>Select the lesson: <select name=”_dappcf_i_dropdown” class=”widefat” style=”width:170px” >’; foreach ($posts as … Read more

Make Permalinks have a custom format?

Please see below. This will solve your problem for all future posts that you publish. I have tried this code. But to be on safer side, please backup your DB before you try or tray on staging. function custom_unique_post_slug( $slug, $post_ID, $post_status, $post_type ) { $post = get_post($post_ID); /* Set a flag to know if … Read more

WP Job Manager Custom Permalink Returns 404 Errors

I had the same issue on my website http://loctim.com because I wanted the slug like this %category%/%state%/%city% I had 404 pages in changing functions.php and today it is the gallery which was crazy. So i worked all the night and I have found that I had forgotten this part of code : function add_category_endpoint_tag() { … Read more

Force/Limit the post/page slug to accept only url friendly characters

For now I used the sanitize_title filter, and removed all unwanted characters, which forces my users to use only [a-z0-9-] as a valid input for titles. ## Allow only [a-z0-9-] in the slug function my_clear_title($title) { $pattern = ‘/[^a-z_0-9- ]/i’; $replace_with=””; return preg_replace($pattern, $replace_with, $title); } add_filter(‘sanitize_title’, ‘my_clear_title’, 3, 1); I had to use a … Read more

HTTPS permalinks resulting in 404

You can use template_redirect to force all the http traffic going through WordPress to use https: function force_secure_navigation() { if ( ! is_ssl() ) : $url=”https://” . $_SERVER[‘HTTP_HOST’] . $_SERVER[‘REQUEST_URI’]; wp_redirect( $url, 301 ); exit(); endif; } add_action( ‘template_redirect’, ‘force_secure_navigation’, 1 ); Remember that if you are working with https it’s important to also serve … Read more

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