Custom Post Type Permalink / Rewrite not working immediately

Use the function flush_rewrite_rules() for set the rewrite rules new, but not with your code on init-hook, only on activation plugin or theme! See more in my post: http://wpengineer.com/2044/custom-post-type-and-permalink/ global $wp_rewrite; $wp_rewrite->flush_rules(); Flush rules only on activation (and deactivation). Don’t do it on any other hook. register_activation_hook()

Rewrite Rule for Multilingual Website, Like qTranslate?

I got it now , After searched many resources : function lang_support() { return array(‘en’,’fr’); // Add your support lang-code (1st place is a default) } function rewrite_lang(){ $langs = lang_support(); foreach($langs as $lang) { add_rewrite_endpoint($lang,EP_PERMALINK|EP_PAGES|EP_ROOT|EP_CATEGORIES); } } add_action(‘init’,’rewrite_lang’); function lang(){ global $wp_query; $langs = lang_support(); $lang_r = “”; foreach($langs as $lang) { if(isset($wp_query->query_vars[$lang])) { … Read more

WordPress slug issue with non-latin characters

Permalinks like http://example/שָׁלוֹם are actually working in my WordPress 3.3. Could be the remove_accents() improvements for i18n permalinks. As Sean & Steve noted, make sure you’re using WordPress ≥ 3.3 make sure your .htaccess file contains a rule similar to RewriteRule . /index.php [L] check that your database is UTF-8 encoded (and consider converting to … Read more

How to set permalink structure via functions.php

You can set the permalink structure by calling on the set_permalink_structure() method of the global $wp_rewrite object. add_action( ‘init’, function() { global $wp_rewrite; $wp_rewrite->set_permalink_structure( ‘/%year%/%monthnum%/%postname%/’ ); } ); Here’s a PHP < 5.3 version of the code in case you’re getting errors. function reset_permalinks() { global $wp_rewrite; $wp_rewrite->set_permalink_structure( ‘/%year%/%monthnum%/%postname%/’ ); } add_action( ‘init’, ‘reset_permalinks’ );

Can I use REST-API on plain permalink format?

Yes you can. Just add the rest_route query parameter. So https://wordpress.org/wp-json/ would become https://wordpress.org/?rest_route=/ Or https://wordpress.org/wp-json/wp/v2/ would become https://wordpress.org/?rest_route=/wp/v2 to give you a more complete example. So you’re wondering how to decide which one to use? Worry no more, there’s a function for that: get_rest_url() Another option is the fact that by default there is … Read more

How can I get the privacy policy page?

WordPress stores the page id for the privacy policy page in the options table. To get the value, you can use: $privacy_policy_page = get_option( ‘wp_page_for_privacy_policy’ ); if( $privacy_policy_page ) { $permalink = esc_url( get_permalink( $privacy_policy_page ) ); } The $privacy_policy_page variable holds the ID of the privacy policy page.

Get page permalink without wpurl

There’s nothing built in to return the bit you want but it should be as easy as using the home_url() function and removing it’s output from the full url eg: function get_relative_permalink( $url ) { return str_replace( home_url(), “”, $url ); }

deneme bonusu veren sitelerbahis casinomakrobetceltabetpinbahispolobetpolobet girişpinbahis girişmakrobet girişpulibet girişmobilbahis girişkolaybet giriş