• I want to write the following code to the file: wp-includes/formatting.php
    In order to Swap out all of the dashes/hyphens (-) for underscores (_):

    $title = strtolower($title);
    $title = preg_replace(‘/&.+?;/’, ”, $title); // kill entities
    $title = str_replace(‘.’, ‘-‘, $title);
    $title = preg_replace(‘/[^%a-z0-9 _-]/’, ”, $title);
    $title = preg_replace(‘/\s+/’, ‘-‘, $title);
    $title = preg_replace(‘|-+|’, ‘-‘, $title);
    $title = trim($title, ‘-‘);

    The code to be replaced:

    $title = strtolower($title);
    $title = preg_replace(‘/&.+?;/’, ”, $title); // kill entities
    $title = str_replace(‘.’, ‘_’, $title);
    $title = preg_replace(‘/[^%a-z0-9 _-]/’, ”, $title);
    $title = preg_replace(‘/\s+/’, ‘_’, $title);
    $title = preg_replace(‘|-+|’, ‘_’, $title);
    $title = trim($title, ‘_’);

Viewing 1 replies (of 1 total)
  • Like said,

    If you rewrite some main functions, it’s at your own risks, WordPress is written to be 100% open.

    That being said, you can trace if this file is called in what you need with simple web coding tools.

    But, you know that it can be rewritten at every update, so it’s better to write your code other way, a bit like supercharge in prestashop.

    Digico

Viewing 1 replies (of 1 total)

The topic ‘If i edit core wordpress code? would it be same after wordpress update?’ is closed to new replies.