How can I mass-update/save all WordPress posts and pages?

Add to your functions.php file, but dont forget to take it off after use it !!!!! function update_all_posts() { $args = array( ‘post_type’ => ‘post’, ‘numberposts’ => -1 ); $all_posts = get_posts($args); foreach ($all_posts as $single_post){ $single_post->post_title = $single_post->post_title.”; wp_update_post( $single_post ); } } add_action( ‘wp_loaded’, ‘update_all_posts’ ); PS : BE SURE TO MAKE A … Read more

Sync my svn repositories

Maybe the svn switch — relocate repository option can help you here: svn switch –relocate oldURL newURL . ( http://svnbook.red-bean.com/en/1.1/re27.html ) But… a lot more options here: https://stackoverflow.com/questions/580443/svn-one-working-copy-two-repositories

How to generate/update a XML sitemap without plugins?

The following code works right off the bat. Your sitemap will show up on: https://your-website-name.com/sitemap.xml Every time you create or update a page, post or custom post type it will show. Make sure to add the name of your custom post type: add_action( ‘publish_post’, ‘ow_create_sitemap’ ); add_action( ‘publish_page’, ‘ow_create_sitemap’ ); add_action( ‘save_post’, ‘ow_create_sitemap’ ); function … Read more

Does wordpress have a post hit counter?

Not in core. You can use post meta to store this information on page loads. If you have caching plugins enabled, you might want to increment the hit counter with an AJAX call, otherwise you can just add this directly in your single.php and page.php templates: //Add to functions.php function get_hits(){ global $post; $hits = … Read more

Add Rewrite Rule for custom page

function add_my_rule() { global $wp; $wp->add_query_var(‘args’); $wp->add_query_var(‘arg_username’); add_rewrite_rule(‘writer/([0-9]+)/([^/]*)/page/([0-9]+)’,’index.php?pagename=writer&args=$matches[1]&arg_username=$matches[2]&paged=$matches[3]’,’top’); add_rewrite_rule(‘writer/([0-9]+)/([^/]*)’,’index.php?pagename=writer&args=$matches[1]&arg_username=$matches[2]’,’top’); /*global $wp_rewrite; $wp_rewrite->flush_rules();*/ } add_action(‘init’, ‘add_my_rule’); This should do the trick. One rewriterule for writer/user_id/username (username isn’t used in the rewriterule but is necessarily to make it work. The second rewriterule is the same except that it adds pagination. EDIT: added arg_username in code above.

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