Need to Echo A Url path to show on a wordpress page

You can find that with somthing like the following add_shortcode( ‘url_path_number’, function ( $atts ) { // use an attribute or the current URL $a = shortcode_atts( array( ‘url’ => get_permalink(), ), $atts ); // get the path from the URL $path = parse_url($a[‘url’],PHP_URL_PATH); $parts = array_filter(explode(“https://wordpress.stackexchange.com/”, $path),function($v) { return $v !== ”; }); // … Read more

Unable to login after changing WordPress site url

Try this First method is Add the above code in wp-config.php define(‘WP_HOME’,’http://localhost/myproject’); define(‘WP_SITEURL’,’http://localhost/myproject’); Second method is Comment Plugins one by one and check. After successfully login update permalink.

URL to Post Archive of Custom Query

Answering my own question seems weird, but here is how I was able to achieve it – function filter_posts_by_id($query) { if ( !is_admin() && is_post_type_archive(‘CPT_NAME’) && $query->is_main_query()) { $post_ids = $_GET[‘post_ids’]; if(!empty($post_ids)) { $pids = explode(‘,’,$_GET[‘post_ids’]); $query->set(‘post__in’, $pids); } } } add_action(‘pre_get_posts’, ‘filter_posts_by_id’); PHP’s predefined variable $_GET[‘parameter’] to get the query string PHP’s explode() to … Read more

Prevent Archive URLs

WordPress generates date archives automatically, it’s just a thing it does. You see the index.php template probably because there isn’t a more specific one for date archives in your current theme. There are plugins that disable these archives, Yoast SEO is one. A quick fix is to empty the date archive rewrite rules: add_filter( ‘date_rewrite_rules’, … Read more

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