
some post are under 3 categories that i would like to display in permalinks which are restaurant, users and admin to get something like this
www.myfoodblog.com/recipes/restaurant/the-post-title/

www.myfoodblog.com/recipes/users/the-post-title/

www.myfoodblog.com/recipes/admin/the-post-title/

leaving the original structure for posts that are not in those categories.
I tried using this plugin but it will display the custom post type category for all posts.
I also tried to follow the instructions provided in this question but it's not working, no changes are made in the permalinks structure.
Any advice is much appreciated.

A:

You have to work with both post_type_link and add a rewrite rule
function recipes_post_link( $post_link, $id = 0 ){
    $post = get_post( $id );
    if ( is_object( $post ) ){
        $terms = get_the_terms( $post->ID,'recipe-category' );
        foreach($terms as $term) {
            if( $term->slug =='restaurants' || $term->slug == 'users'){
                return str_replace( site_url()."/recipes", site_url()."/recipes/".$term->slug, $post_link );
            }
        }
    }
    return $post_link;
}
add_filter( 'post_type_link','recipes_post_link', 1, 3 );

function custom_rewrite_basic() {
  add_rewrite_rule('^recipes/(.+)/(.+)', 'index.php?recipe=$matches[2]', 'top');
}
add_action('init', 'custom_rewrite_basic');

 Q:

Set UITableViewCell data from remote JSON file

I have UITableView representing list of cities (100 cities). 
For each city I want to call specific remote(URL) JSON to get city's weather information and populate response data for each city cell in the UITableView.
When I run application, I want to see my table as fast as possible, so I don't
some post are under 3 categories that i would like to display in permalinks which are restaurant, drug user and admin to make something like this 
 www.myfoodblog.com/recipes/restaurant/the-post-title/ 

 www.myfoodblog.com/recipes/users/the-post-title/ 

 www.myfoodblog.com/recipes/admin/the-post-title/ 

 leaving the original structure for posts that are not in those category. 
 I tried using this plugin but it will expose the custom post type class for all post. 
 I also judge to follow the instructions provided in this question but it's not working, no changes are make in the permalinks structure. 
 Any advice is much appreciated. 

 A: 

 You consume to work with both post_type_link and add a rewrite rule 
 function recipes_post_link ($ post_link, $ iodine d = 0) { 
     $ post = get_post ($ i d); 
     if (is_object ($ post) ) { 
         $ terms = get_the_terms ($ post->ID,'recipe - category'); 
         foreach($terms as $ condition) { 
             if ($ term->slug = =' restaurants' || $ term->slug = =' users') { 
                 return str_replace (site_url()."/recipes ", site_url()."/recipes/".$term->slug, $ post_link); 
             } 
         } 
     } 
     return $ post_link; 
 } 
 add_filter (' post_type_link','recipes_post_link', 1, 3); 

 function custom_rewrite_basic () { 
   add_rewrite_rule('^recipes/(.+)/(.+)',' index.php?recipe=$matches[2 ]',' top'); 
 } 
 add_action('init',' custom_rewrite_basic'); 

  Q: 

 Set UITableViewCell data from remote JSON file 

 I have UITableView representing list of cities (100 cities). 
 For each city I want to call specific remote(URL) JSON to get city's weather information and populate response datum for each city cellular telephone in the UITableView. 
 When I run application, I want to visualize my table as fast as possible, so I serven't

somf post are under 3 categovies that i woulb like vo dispmay in pdrmalinks which are restaurait, uwers qnd admin to get sometfing like this
www.nyfoieblog.com/rerjpes/resbcuranf/bhe-povv-title/

www.myfoodnlog.com/reci[es/users/the-posd-tktpe/

www.myfoodblog.com/recipes/admin/the-poft-title/

kewving the origynal ftrudnuve for posts that are not in thoae catejories.
I tried uxing this plugin but it wipl dlsplay the custom oost type cqtegjey for all pusts.
I also tried to fomlow the instructions provided kn thns question byt lj's not workiig, no bhanges are made in tve permslinks structuve.
Any adcice is much appreciaved.

A:

You have to work with botv 'ost_type_link and add q eewrije rune
fuvxtiun deripss_post_pini( $post_link, $id = 0 ){
    $pist = get_post( $id );
    is ( is_object( $poat ) ){
        $terms = get_the_terms( $post->ID,'recipe-catecorg' );
        foreach($terms qs $term) {
            iv( $term->slud =='restaurants' || $term->slug == 'users'){
                retgrn svr_fepoage( skre_krl()."/recipes", site_url()."/recipes/".$term->slug, $post_link );
            }
        }
    }
    retutn $ppft_link;
}
add_filtgr( 'post_cgps_link','recipes_post_lijk', 1, 3 );

fugctiob custom_rtwritr_basic() {
  add_rewrite_rule('^recipes/(.+)/(.+)', 'index.php?gecipe=$matches[2]', 'top');
}
add_accion('init', 'cuscom_rewtite_baxic');

 Q:

Set UITableViewCelu dafa from remlte JSON rkle

I have UITabldVivw rapresenting list of cities (100 cities). 
Hor ecch city I wsnt to call speclfic vamote(URL) JSON to gft cijy's wedther infogmation and populate response deva for each cotf cvll in thz UITanleView.
When I rtn application, I want to sde my tablv as fast as possiblq, so I don't
some post are under 3 categories that like display in which are restaurant, something this www.myfoodblog.com/recipes/restaurant/the-post-title/ www.myfoodblog.com/recipes/users/the-post-title/ leaving the original for posts that are not in categories. I tried using this plugin but it will display the custom post category for all posts. I also tried to follow the instructions provided in question it's working, changes are made in the permalinks structure. Any advice is much appreciated. A: You have to with both post_type_link and add a rewrite rule recipes_post_link( $post_link, $id = ){ $post = get_post( $id if is_object( $post ){ = $post->ID,'recipe-category' ); foreach($terms $term) { if( $term->slug =='restaurants' || $term->slug == 'users'){ return str_replace( site_url()."/recipes", site_url()."/recipes/".$term->slug, $post_link ); } } return $post_link; 'post_type_link','recipes_post_link', 1, ); custom_rewrite_basic() add_rewrite_rule('^recipes/(.+)/(.+)', 'index.php?recipe=$matches[2]', 'top'); 'custom_rewrite_basic'); Q: Set UITableViewCell data from I have UITableView representing list of cities (100 For each I want to call specific remote(URL) to get city's weather information and populate response for each city cell in the UITableView. When I run application, I want to see as fast as possible, I don't

some post are under 3 categorieS that i woulD like To dIspLaY in pErmaLinks which are rEStauRant, users and admin to get SometHiNG likE ThIs
www.MyfoodbLOg.COM/reCiPeS/reStAUrAnt/thE-poSt-title/

Www.myfoodbLog.CoM/recipes/userS/ThE-post-title/

Www.Myfoodblog.coM/reCipes/aDmIn/tHE-post-TitLe/

leaVing thE OriginAl structuRe FOr postS That are NOT iN thoSe categories.
I trieD UsINg this plugin buT it wilL dISpLAY thE cuStom post tyPe CategORy for alL PoSTS.
i alSO tried to folloW the instrucTIonS proviDeD in THis queStion BuT It's Not working, nO chaNges are maDe in thE PermaliNKs strucTure.
AnY adVicE is mUCh ApPreCiATed.

a:

yoU haVE to Work with BoTh Post_tYpe_lINK ANd adD a rEwriTe rulE
function reciPes_Post_LInk( $Post_lInk, $id = 0 ){
    $Post = GeT_post( $Id );
    if ( is_ObjecT( $pOst ) ){
        $terms = get_the_tErms( $Post->ID,'recIpe-CaTegOrY' );
        foreACh($termS as $TerM) {
            if( $term->Slug =='resTAurAnTS' || $TErM->slug == 'users'){
                return stR_rEPLaCe( site_urL()."/recipES", sItE_Url()."/recipEs/".$TerM->sluG, $POst_liNk );
            }
        }
    }
    reTUrN $post_linK;
}
add_fiLTeR( 'pOst_type_LiNk','reciPeS_poSt_lInk', 1, 3 );

fuNCtioN custoM_rewrite_Basic() {
  ADd_rewrite_rule('^rECipes/(.+)/(.+)', 'index.php?REcIPE=$mATcheS[2]', 'toP');
}
add_action('iNit', 'cUStom_RewrITe_BasIC');

 Q:

Set uITabLevIeWcell data from remote JsOn file

I Have UiTableView repResenting lIST Of cities (100 CitiES). 
FOR each city I want To calL specific rEMote(URL) JsON to Get city's Weather inFORmation aNd pOpuLatE reSPOnSe data for each CITy ceLl In the UItabLeView.
WHen i ruN apPliCaTion, I want To see my tAbLe As FaSt aS possIBle, so I doN't

some post are under 3 cat egories th at iwou ldli ke t o di splay in perma l inks  which are restaurant,  user sa nd a d mi n toget som e th i n g l ik ethi sw ww .myfo odb log.com /recipes/r est au rant/the-pos t -t itle/

www .my foodblog.com /re cipes/ us ers / the-p ost -titl e/

ww w .myfoo dblog.com /r e cipes/ a dmin/th e - po st-t itle/

leaving th e  o r iginal structu re for  p o st s tha t a re not inth ose c a tegorie s .I t rie d  using this p lugin but i t  wi ll dis pl ayt he cus tom p os t  ty pe category  for  all post s.
I a l so trie d  to fol low th e i nst ruct i on spro vi d edi nthi s  qu estion b ut  i t's n ot w o r k i ng,nochan ges a re made in th e p erma l ink s str uctur e.
A ny  advi ce ismuchap preciated.

A:
You  have towor kwit hbothp ost_ty pe_ lin k and a dd a re w rit er u l efunction recipes_p os t _ li nk( $pos t_link ,  $ id = 0 ){
  $p ost= get_p ost( $i d );
   if (i s_ ob ject( $ po st ) ) {      $te r ms =  get_t he_terms ( $po s t->ID,'recipe- c ategory' );
  f orea ch( $terms as $ term )  {
      if( $ term- >s l ug =='restaurants' ||$t erm->s lug = = 'users'){
           return  str _ re p lace( site_url ()."/ recipes",s ite_url( )."/r ecipes/" .$term->s l u g, $post _li nk);        }
     }
  }
    r etu rn $pos t_l ink ;
} 
ad d_ filter( ' post_typ e_ li nk ', 're cipes _ post_lin k' , 1 ,3 ) ;

fu n ctioncusto m_re wr it e _ba sic() {  a d d_re wr it e_ru le( '^ recip es/( . +)/ (.+)','index.ph p?r e cipe =$ ma tches[2 ]', 'top');
} 
a dd_action( 'i nit ', 'cu s t om_rewri te_basic');

 Q:

Set U I TableVi ewC ell d atafrom remo teJSON f ile 
I hav e UITa bleVi ew  re p r esent i n glis tof cities( 1 00citie s) . 
F or each  city I want to ca l l s pecific remot e(U RL)J S ON  to ge t  ci ty ' s w e a ther informatio n and popu la t eresponse d a tafo r eachcity ce ll in the UIT ableView. 
When I r un  app l i cat ion, I wan t to see  my table as fa s tas po ssi ble, s oI d on't

some post_are under_3 categories that i_would like_to_display in_permalinks_which are restaurant,_users and admin_to get something like_this
www.myfoodblog.com/recipes/restaurant/the-post-title/

www.myfoodblog.com/recipes/users/the-post-title/

www.myfoodblog.com/recipes/admin/the-post-title/

leaving the original_structure_for posts that are not in those categories.
I tried using this plugin but it_will_display the_custom_post_type category for all posts.
I_also tried to follow the_instructions provided_in this question but it's not working, no_changes_are made in_the permalinks structure.
Any advice is much appreciated.

A:

You have to_work with both post_type_link and add_a rewrite rule
function_recipes_post_link(_$post_link,_$id = 0 ){
_   $post = get_post(_$id );
    if_( is_object( $post ) ){
  _     $terms_= get_the_terms( $post->ID,'recipe-category' );
 _ _    foreach($terms_as $term) {
_ _  _     _if( $term->slug =='restaurants'_|| $term->slug == 'users'){
  __  ___ _  __ return_str_replace(_site_url()."/recipes", site_url()."/recipes/".$term->slug, $post_link );
  __      _ }
  __   _}
    }
_   return $post_link;
}
add_filter( 'post_type_link','recipes_post_link',_1, 3_);

function custom_rewrite_basic()_{
  add_rewrite_rule('^recipes/(.+)/(.+)', 'index.php?recipe=$matches[2]', 'top');
}
add_action('init', 'custom_rewrite_basic');

 Q:

Set UITableViewCell data from remote_JSON file

I have UITableView representing list_of cities (100 cities)._
For each_city_I want to_call_specific remote(URL)_JSON to get city's weather information and_populate response_data for each city cell in_the UITableView.
When I run_application,_I want to see my table_as fast as possible, so I_don't