What is the proper way implement a global $wp_rewrite?

It is not necessary to define $wp_rewrite in your function. The add_permastruct() and add_rewrite_rule() functions take care of that for you. Try removing the “global $wp_rewrite;” line and see if your code still works. The add_permastruct() function currently accepts three parameters. There is some backwards-compatibility logic in the function to correct for calls using the … Read more

How to use WP_rewrite?

WordPress generates its .htaccess rules by WP_Rewrite->mod_rewrite_rules() method. It passes output through the mod_rewrite_rules filter, which allows you to edit it. To make the new rules be written you will also need to call “hard” reset with flush_rewrite_rules( true ) call.

Add custom content to nonexistent page

In your first example, you add the rewrite tag personal-development, but then you use the rewrite tag class_type inside your rewrite rule. That method would work if you fixed that error, and assuming 17318 is the page id of your personal-development page. You could then use get_query_var(‘personal_development’) in the template or a template hook, to … Read more

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