permalinks - Wordpress perma links -



permalinks - Wordpress perma links -

ok made plugin contact form, thing have redirection when form submited success page

$location = home_url().'/potvrda-prijave/'; wp_safe_redirect($location); exit();

thing when alter permalinks construction 404, knows how grab permalinks alter , alter redirection link? this

$location = home_url().'/potvrda-prijave/';

to

$location = home_url().'id=21';

since know page id, can utilize get_permalink():

$location = get_permalink( 21 );

edit: looks don't know id...in case, if know title, can use:

$location = get_permalink( get_page_by_title( 'your page title' ) );

however, if you're using wp_insert_post() create post in first place, function returns page id of added post. so:

$added_post = wp_insert_post( $my_post ); $location = get_permalink( $added_post );

wordpress permalinks

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -