How to add .htaccess code through a function?

/** * Inserts an array of strings into a file (.htaccess ), placing it between * BEGIN and END markers. Replaces existing marked info. Retains surrounding * data. Creates file if none exists. * * @param array|string $insertion * @return bool True on write success, false on failure. */ function add_htaccess($insertion) { $htaccess_file = ABSPATH.’.htaccess’; … Read more

Rewrite rules goes away

properties_add_rewrite_rules should be hooked to init so it runs on every request. Rules can be flushed at any time- loading the permalinks settings page calls flush_rewrite_rules, and your rules weren’t added on that request, so they disappear.

How to check if last uri segment is a custom post type or taxonomy term?

To see how we can make this work, have a read through the Query Overview Codex page, particularly the What Plugins can Modify section: Modify the query specification, after variable values are saved (request filter or parse_request action; if you want to use conditional tag tests, use the parse_query or pre_get_posts action, as these run … Read more

WordPress in “Couch Mode”?

Here’s a method to achieve what you want internally without adding anything to the .htaccess file. It works by adding a rewrite endpoint named read, so any single post permalink with read appended to the end will have a different single post template applied. For example, if your normal single post permalink is: localhost/techylab/some-post-title/ The … Read more

Custom comments

$args = array(‘post_id’=>get_the_ID(), ‘status’=> ‘approve’); $all_comm = get_comments($args); $per_page = get_option(“comments_per_page”); if(!$per_page) $per_page = 4; $cpage = get_query_var(“cpage”); if(!$cpage) $cpage = 1; if(round(count($all_comm)/$per_page) == 0) $total = 1; else $total = round(count($all_comm)/$per_page); $args_comments = array( ‘base’ => add_query_arg( ‘cpage’, ‘%#%’ ), ‘format’ => “”, ‘total’ => $total, ‘current’ => $cpage, ‘echo’ => false, ‘add_fragment’ => … Read more

WordPress Network on IIS7/SQL Server – Rewrite Issues

This sounds like your domain doesn’t match the cookie being generated. It may not have anything to do with the IP. define( ‘DOMAIN_CURRENT_SITE’, ‘svr-web-csrms’ ); I would expect an actual domain or something, like this. define( ‘DOMAIN_CURRENT_SITE’, ‘subdomain.mysite.tld’ ); I tried to look at your web.config – but it appears that the URL is now … Read more

Prepend meta_value to permalink of post

In this case it seems like you’ll want to hook into the WordPress rewrite rules. {$permastruct}_rewrite_rules doesn’t have a lot of information, but this filter would allow you modify the array of existing rewrite rules to add in your new rewrite rule for series. For this to work: http://example.com/series/movie_slug/parrent_series_slug/series_slug You’ll need to add in movie_slug, … Read more

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