MultiSite Move conjures duplicate URL

I would suggest to use Search and Replace utility when you move your WordPress Network. it seamlessly update all the fields of the database from old domain to new domain. After that, you only need to update the domain name in wp-config.php. (Tip: do not include http:// and trailing slash while replacing the domain rather … Read more

Random post category URL

Pro tip – don’t custom query unless you need to (you don’t). And never use the guid field. if ( is_singular() && $cats = get_the_category() ) $cat_id = $cats[0]->term_id; // Category ID for current post elseif ( is_category() ) $cat_id = get_queried_object_id(); // Category ID for current archive else $cat_id = 0; // No cats … Read more

Ninja form Redirect depending on text field content [closed]

I am not sure whether you have hooked this function to appropriate action. Also you have not concatenated the strings properly: Instead of $newdestinationurl = $url/$destinationurlslug ; it should be $newdestinationurl = $url.”https://wordpress.stackexchange.com/”.$destinationurlslug ; Please see below for the complete code: function ninja_forms_handler() { add_action ( ‘ninja_forms_post_process’, ‘change_ninja_forms_landing_page’, 1, 2 ); } add_action(‘init’, ‘ninja_forms_handler’); function … Read more

urlencode query string in gravity forms confirmation redirect

After digging a little deeper, I found that there is an action hook in Gravity Forms called gform_pre_submission. This allows me to modify a posted value before creating an entry or running the confirmation (see documentation). After that it was pretty basic: add_action( ‘gform_pre_submission_11’, ‘pre_submission_handler’ ); function pre_submission_handler( $form ) { $_POST[‘input_7’] = urlencode(rgpost( ‘input_7’ … Read more

URI returns a post when it should return a 404

WordPress tries to guess what post the user want to see by post name. That is what is making both example.com/new-bikes/ktm/duke/ktm-690-duke-2012/ and example.com/new-bikes/ktm/yamaha/ktm-690-duke-2012/ return the same and “correct” content. What is important is that, if you see at the source code of example.com/new-bikes/ktm/yamaha/ktm-690-duke-2012/, you can see the canonical URL correctly set to example.com/new-bikes/ktm/duke/ktm-690-duke-2012/. User gets … Read more

How to Get a part of URL and put in shortcode?

This should work: function get_name() { $url = “http://domain.com/author/peter”; if (preg_match(“/author/”, $url )) { $lastSlash = strrpos( $url, “https://wordpress.stackexchange.com/”); return substr( $url, $lastSlash, strlen($url)); } } This will return everything after the last slash.

How to Add a Rewrite Rule for Only One Page?

Asumption: You use Apache as your web server. If you already know the page slugs and they won’t change, just add them to your .htaccess file. It’ll be much faster and less complicated. Paste the following Redirect lines at the top of your .htaccess file. Redirect 301 /pagetitle/ /service/pagetitle/ Redirect 301 /pagetitle2/ /another-dir/pagetitle2/ # BEGIN … Read more

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