Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter hug963

    (@hug963)

    Hi,

    It turned out the problem is in the way wordpress analyses the url. It is found in rewrite.php:

    /**
    670	         * Rewrite tags that can be used in permalink structures.
    671	         *
    672	         * These are translated into the regular expressions stored in
    673	         * {@link WP_Rewrite::$rewritereplace} and are rewritten to the
    674	         * query variables listed in {@link WP_Rewrite::$queryreplace}.
    675	         *
    676	         * Additional tags can be added with {@link add_rewrite_tag()}.
    677	         *
    678	         * @since 1.5.0
    679	         * @access private
    680	         * @var array
    681	         */
    682	        var $rewritecode = array(
    683	                '%year%',
    684	                '%monthnum%',
    685	                '%day%',
    686	                '%hour%',
    687	                '%minute%',
    688	                '%second%',
    689	                '%postname%',
    690	                '%post_id%',
    691	                '%author%',
    692	                '%pagename%',
    693	                '%search%'
    694	        );
    695
    696	        /**
    697	         * Regular expressions to be substituted into rewrite rules in place
    698	         * of rewrite tags, see {@link WP_Rewrite::$rewritecode}.
    699	         *
    700	         * @since 1.5.0
    701	         * @access private
    702	         * @var array
    703	         */
    704	        var $rewritereplace = array(
    705	                '([0-9]{4})',
    706	                '([0-9]{1,2})',
    707	                '([0-9]{1,2})',
    708	                '([0-9]{1,2})',
    709	                '([0-9]{1,2})',
    710	                '([0-9]{1,2})',
    711	                '([^/]+)',
    712	                '([0-9]+)',
    713	                '([^/]+)',
    714	                '([^/]+?)',
    715	                '(.+)'
    716	        );

    as you can see any url with four numbers will be taken as a year(first lines), I just had to redefine $rewritereplace in my functions.php and flush the rules. I just replaced the first line ‘([0-9]{4})’, by ‘([0-9]{8})’, but you can replace it with anything.

    don’t edit the wordpress files directly though.

    Good luck

Viewing 1 replies (of 1 total)