Skip to content
Advertisement

How do i add multiple classes to the_post_pagination array?

If i try to add multiple classes into the the_post_pagination array class string with a space between the words it will stick them together when the code is executed. Is there a way to do this correctly?

JavaScript

Advertisement

Answer

By default, WordPress sanitizes the class that is included in a pagination, removing certain characters, space included. You can make a hack to overwrite it.

in functions.php, add the following line:

JavaScript

That way, you will retain the string you need and also clean the input from malicious content. Of course change ‘your classes’ to the classes you put in the the_post_pagination function.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement