How to edit 404 content via wp editor?

Found a way. Create a regular page for 404 content, say ‘Page not found’; In your 404.php file, get that page data and then write down your content or whatever… For example: $page = get_page_by_title(“Page not found”); if($page) echo apply_filters(‘the_content’,$page->post_content); Obviously, you can do a lot more…

Custom Post Type rewrite rules not working, how to alter the rewrite order?

While you’ve found the problem already, here is some basic code to move a specific rule to the end of the rewrite rules with the rewrite_rules_array filter for people stumbling across a similar problem. Say I want to move the rule for ([^/]*)/([^/]*)/?$: add_filter(“rewrite_rules_array”, function($rules) { $keys = array_keys($rules); foreach($keys as $rule) { if($rule == … Read more

Custom Permalink with Dynamic Taxonomy for Custom Post Type – Works, but breaks other permalinks

If you’re running WordPress 3.0.1 or later, I believe your problem lies with the ‘post_type_link’ filter declaration and function arguments. When the ‘post_type_link’ filter is applied, it passes the following 4 arguments: apply_filters(‘post_type_link’, $post_link, $post, $leavename, $sample); But your function accepts $post_link and $id. Try the following adjustments: function custom_post_link( $post_link, $post ) { if … Read more

404 to 301 – Fixing old links

If you intend to do checks based on template tags you should hook on wp action. template_redirect will suffice too, but wp is earlier. This is when WP handles 404 itself. To perform a 301 redirect use status_header( 301 );, wp_safe_redirect(); immediately followed by exit; You could use a plugin handle these for you. It’s … Read more

there’s a way to include a minimal WP for check only the current user, its roles (caps?) and then release/free it?

The no no about loading wp-* files directly are reasonable when you are developing a WordPress plugin or theme, but if you are developing an external code that require WP (and that seems your case) than you must require that files, there is no alternatives. Consider that including wp-blog-header.php is needed when you need to … Read more

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